Areas and Fixes
Added CCOH and missing areas Changed some areas to be craftable, Fixed some on death issues, Fixed the Gaurd
This commit is contained in:
26
_module/nss/20levelrestrict.nss
Normal file
26
_module/nss/20levelrestrict.nss
Normal file
@@ -0,0 +1,26 @@
|
||||
string sDeny;
|
||||
/* Script generated by
|
||||
Lilac Soul's NWN Script Generator, v. 2.2
|
||||
|
||||
For download info, please visit:
|
||||
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625 */
|
||||
|
||||
//Put this script OnClick or OnFailToOpen
|
||||
void main()
|
||||
{
|
||||
|
||||
object oPC = GetClickingObject();
|
||||
|
||||
if (!GetIsPC(oPC)) return;
|
||||
|
||||
if (GetHitDice(oPC) < 20)
|
||||
{
|
||||
sDeny="You are to high a level for this war.";
|
||||
|
||||
SendMessageToPC(oPC, sDeny);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
220
_module/nss/____plant_list.nss
Normal file
220
_module/nss/____plant_list.nss
Normal file
@@ -0,0 +1,220 @@
|
||||
void main()
|
||||
{
|
||||
|
||||
// NAME RESREF TAG RESOURCERESREF RESOURCETAG
|
||||
//----------------------------------------------------------------------------------
|
||||
// Cornstalk plant001 PLANT_CORNSTALK food001/cornkernels SEED_CORN
|
||||
// Wheat plant002 PLANT_WHEAT wheatgrains SEED_WHEAT
|
||||
// Rice plant003 PLANT_RICE ricegrains SEED_RICE
|
||||
// Oats plant004 PLANT_OATS oatgrains SEED_OATS
|
||||
// Barley plant005 PLANT_BARLEY barleygrains SEED_BARLEY
|
||||
// Sorghum plant006 PLANT_SORGHUM sorghumgarins SEED_SORGHUM
|
||||
// Bamboo plant007 PLANT_BAMBOO bambooshoots SEED_BAMBOO
|
||||
// Spearmint plant008 PLANT_SPEARMINT spearmint SEED_SPEARMINT
|
||||
// Peppermint plant009 PLANT_PEPPERMINT peppermint SEED_PEPPERMINT
|
||||
// Garlic plant010 PLANT_GARLIC cloveofgarlic SEED_GARLIC
|
||||
// Onion plant011 PLANT_ONION onionbulb SEED_ONION
|
||||
// Blueberry Bush plant012 PLANT_BLUEBERRY blueberry SEED_BLUEBERRY
|
||||
// Blackberry Bush plant013 PLANT_BLACKBERRY blackberry SEED_BLACKBERRY
|
||||
// Raspberry Bush plant014 PLANT_RASPBERRY raspberry SEED_RASPBERRY
|
||||
// Cranberry Bush plant015 PLANT_CRANBERRY cranberry SEED_CRANBERRY
|
||||
// Grape Vine (P) plant016 PLANT_GRAPE1 grapepurple SEED_GRAPE1
|
||||
// Grape Vine (R) plant017 PLANT_GRAPE2 grapered SEED_GRAPE2
|
||||
// Grape Vine (Y) plant018 PLANT_GRAPE3 grapeyellow SEED_GRAPE3
|
||||
// Gooseberry Bush plant019 PLANT_GOOSEBERRY gooseberry SEED_GOOSEBERRY
|
||||
// Juniper Berry plant020 PLANT_JUNIPERBERRY juniperberry SEED_JUNIPERBERRY
|
||||
// Marigold plant021 PLANT_MARIGOLD marigold SEED_MARIGOLD
|
||||
// Snapdragon plant022 PLANT_SNAPDRAGON snapdragon SEED_SNAPDRAGON
|
||||
// Nasturtium plant023 PLANT_NASTURTIUM nasturtium SEED_NASTURTIUM
|
||||
// Black Iris plant024 PLANT_BLACKIRIS blackiris(tuber) SEED_BLACKIRIS/FLOWER_BLACKIRIS
|
||||
// Yellow Iris plant025 PLANT_YELLOWIRIS yellowiris(tuber) SEED_YELLOWIRIS/FLOWR_YELLOWIRIS
|
||||
// Blue Iris plant026 PLANT_BLUEIRIS blueiris(tuber) SEED_BLUEIRIS/FLOWER_BLUEIRIS
|
||||
// Red Iris plant027 PLANT_REDIRIS rediris(tuber) SEED_REDIRIS/FLOWER_REDIRIS
|
||||
// White Iris plant028 PLANT_WHITEIRIS whiteiris(tuber) SEED_WHITEIRIS/FLOWER_WHITEIRIS
|
||||
// Cotton plant029 PLANT_COTTON headofcotton FLOWER_COTTON/SEED_COTTON/ITEM_COTTON
|
||||
// Ginger plant030 PLANT_GINGER gingerroot SEED_GINGER
|
||||
// Mandrake plant031 PLANT_MANDRAKE mandrakeroot SEED_MANDRAKE
|
||||
// Sassafrass plant032 PLANT_SASSAFRASS sassafrassroot SEED_SASSAFRASS
|
||||
// Red Tulip plant033 PLANT_REDTULIP redtulipbulb SEED_REDTULIP redtulip/FLOWER_REDTULIP
|
||||
// Black Tulip plant034 PLANT_BLACKTULIP blacktulipbulb SEED_BLACKTULIP blacktulip/FLOWER_BLACKTULIP
|
||||
// White Tulip plant035 PLANT_WHITETULIP whitetulipbulb SEED_WHITETULIP whitetulip/FLOWER_WHITETULIP
|
||||
// Yellow Tulip plant036 PLANT_YELLOWTULIP yellowtulipbulb SEED_YELLOWTULIP yellowtulip/FLOWER_YELLOWTULIP
|
||||
// Blue Tulip plant037 PLANT_BLUETULIP bluetulipbulb SEED_BLUETULIP bluetulip/FLOWER_BLUETULIP
|
||||
// Tarragon plant038 PLANT_TARRAGON tarragon SEED_TARRAGON
|
||||
// Sage plant039 PLANT_SAGE sage SEED_SAGE
|
||||
// Lavander plant040 PLANT_LAVENDER lavender SEED_LAVENDER
|
||||
// Periwinkle plant041 PLANT_PERIWINKLE periwinkle SEED_PERIWINKLE
|
||||
// Mistletoe plant042 PLANT_MISTLETOE mistletoe SEED_MISTLETOE
|
||||
// Oriental Poppy plant043 PLANT_ORIENTALPOPPY orientalpoppy SEED_ORIENTALPOPPY
|
||||
// Larkspur plant044 PLANT_LARKSPUR larkspur SEED_LARKSPUR
|
||||
// Mayapple plant045 PLANT_MAYAPPLE mayapple SEED_MAYAPPLE
|
||||
// Chives plant046 PLANT_CHIVES chives SEED_CHIVES
|
||||
// Radish plant047 PLANT_RADISH radish SEED_RADISH
|
||||
// Lettuce plant048 PLANT_LETTUCE lettuce SEED_LETTUCE
|
||||
// Turnip plant049 PLANT_TURNIP turnip SEED_TURNIP
|
||||
// Pumpkin plant050 PLANT_PUMPKIN pumpkinseeds SEED_PUMPKIN ITEM_PUMPKIN/pumpkin
|
||||
// Watermelon plant051 PLANT_WATERMELON watermelonseeds SEED_WATERMELON ITEM_WATERMELON/watermelon
|
||||
// Squash plant052 PLANT_SQUASH wintersquashseed SEED_SQUASH ITEM_SQUASH/wintersquash
|
||||
// Zucchini plant053 PLANT_ZUCCHINI zucchinisquashse SEED_ZUCCHINI ITEM_ZUCCHINI
|
||||
// Carrot plant054 PLANT_CARROT carrot SEED_CARROT
|
||||
// Potato plant055 PLANT_POTATO potato SEED_POTATO
|
||||
// Sweet Potato plant056 PLANT_SWEETPOTATO sweetpotato SEED_SWEETPOTATO
|
||||
// Peanuts plant057 PLANT_PEANUTS peanuts SEED_PEANUTS
|
||||
// Indian Corn plant058 PLANT_INDIANCORN indiancornkernel SEED_INDIANCORN ITEM_INDIANCORN/earofindiancorn
|
||||
// Popcorn plant059 PLANT_POPCORN popcornkernels SEED_POPCORN ITEM_POPCORN/earofpopcorn
|
||||
// Catnip plant060 PLANT_CATNIP catnip SEED_CATNIP
|
||||
// Green Beans plant061 PLANT_GREENBEANS greenbeans SEED_GREENBEANS
|
||||
// Peas plant062 PLANT_PEAS peas SEED_PEAS
|
||||
// Beets plant063 PLANT_BEETS beets SEED_BEETS
|
||||
// Oregano plant064 PLANT_OREGANO oregano SEED_OREGANO
|
||||
// Basil plant065 PLANT_BASIL basil SEED_BASIL
|
||||
// Parsley plant066 PLANT_PARSLEY parsley SEED_PARSLEY
|
||||
// Artichoke plant067 PLANT_ARTICHOKE artichoke SEED_ARTICHOKE
|
||||
// Celery plant068 PLANT_CELERY celery SEED_CELERY
|
||||
// Okra plant069 PLANT_OKRA okra SEED_OKRA
|
||||
// Tomato plant070 PLANT_TOMATO tomato SEED_TOMATO
|
||||
// Hops
|
||||
// Cabbage
|
||||
// Sweet Peas
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Oak Tree tree02 TREE_OAK
|
||||
// Elm Tree tree03 TREE_ELM
|
||||
// Birch Tree tree04 TREE_BIRCH
|
||||
// Almond Tree tree05 TREE_ALMOND
|
||||
// Willow Tree tree06 TREE_WILLOW
|
||||
// Orange Tree tree07 TREE_ORANGE
|
||||
// Green Apple Tree tree08 TREE_GREENAPPLE
|
||||
// Yellow Apple Tree tree09 TREE_YELLOWAPPLE
|
||||
// Red Apple Tree tree10 TREE_REDAPPLE
|
||||
// Plum Tree tree11 TREE_PLUM
|
||||
// Pear Tree tree12 TREE_PEAR
|
||||
// Cherry Tree tree13 TREE_CHERRY
|
||||
// Tangarine Tree tree14 TREE_TANGARINE
|
||||
// Grapefruit Tree tree15 TREE_GRAPEFRUIT
|
||||
// Elderberry Tree tree16 TREE_ELDERBERRY
|
||||
// Pecan Tree tree17 TREE_PECAN
|
||||
// Fig Tree tree18 TREE_FIG
|
||||
// Lemon Tree tree19 TREE_LEMON
|
||||
// Lime Tree tree20 TREE_LIME
|
||||
// Walnut Tree tree21 TREE_WALNUT
|
||||
// Olive Tree tree22 TREE_OLIVE
|
||||
// Yew Tree tree23 TREE_YEW
|
||||
// Maple Tree tree24 TREE_MAPLE
|
||||
// Mango Tree tree25 TREE_MANGO
|
||||
// Kiwi Tree tree26 TREE_KIWI
|
||||
// Coconut Palm Tree tree27 TREE_PALM
|
||||
// Pine Tree tree28 TREE_PINE
|
||||
// Fir Tree tree29 TREE_FIR
|
||||
// Sausage Tree tree30 TREE_SAUSAGE
|
||||
// Date Tree tree31 TREE_DATE
|
||||
// Mahogany Tree tree32 TREE_MAHOGANY
|
||||
// Hickory Tree tree33 TREE_HICKORY
|
||||
// Redwood Tree tree34 TREE_REDWOOD
|
||||
// Ironwood Tree tree35 TREE_IRONWOOD
|
||||
// Mangrove Tree tree36 TREE_MANGROVE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// pelt001 PELT_BROWNBEAR Brown Bear Pelt meat001 MEAT_BROWNBEAR Brown Bear Meat
|
||||
// pelt002 PELT_BLACKBEAR Black Bear Pelt
|
||||
// pelt003 PELT_GRIZZLYBEAR Grizzly Bear Pelt
|
||||
// pelt004 PELT_POLARBEAR Polar Bear Pelt
|
||||
// pelt005 PELT_DIREBEAR Dire Bear Pelt
|
||||
// pelt006 PELT_ANCIENTDIREBEAR Ancient Dire Bear Pelt
|
||||
// pelt007 PELT_DOG Dog Pelt
|
||||
// pelt008 PELT_WOLF Wolf Pelt
|
||||
// pelt009 PELT_WORG Worg Pelt
|
||||
// pelt010 PELT_DIREWOLF Dire Wolf Pelt
|
||||
// pelt011 PELT_WINTERWOLF Winter Wolf Pelt
|
||||
// pelt012 PELT_COUGAR Cougar Pelt
|
||||
// pelt013 PELT_CRAGCAT Crag Cat Pelt
|
||||
// pelt014 PELT_PANTHER Panther Pelt
|
||||
// pelt015 PELT_MALARPANTHER Malar Panther Pelt
|
||||
// pelt016 PELT_LION Lion Pelt
|
||||
// pelt017 PELT_LEOPARD Leopard Pelt
|
||||
// pelt018 PELT_JAGUAR Jaguar Pelt
|
||||
// pelt019 PELT_DIRETIGER Dire Tiger Pelt
|
||||
// pelt020 PELT_BADGER Badger Pelt
|
||||
// pelt021 PELT_BAT Bat Pelt
|
||||
// pelt022 PELT_COW Cow Pelt
|
||||
// pelt023 PELT_DEER Deer Pelt
|
||||
// pelt024 PELT_DIREBADGER Dire Badger Pelt
|
||||
// pelt025 PELT_DIRERAT Dire Rat Pelt
|
||||
// pelt026 PELT_RAT Rat Pelt
|
||||
// pelt027 PELT_OX Ox Pelt
|
||||
// pelt028 PELT_WHITESTAG White Stag Pelt
|
||||
|
||||
|
||||
// dye001 DYE_AQUA Dye (Aqua)
|
||||
// dye002 DYE_BLACK Dye (Black)
|
||||
// dye003 DYE_BLUE Dye (Blue)
|
||||
// dye004 DYE_YELLOW Dye (Yellow)
|
||||
// dye005 DYE_GREEN Dye (Green)
|
||||
// dye006 DYE_BROWN Dye (Brown)
|
||||
// dye007 DYE_GOLD Dye (Gold)
|
||||
// dye008 DYE_BRONZE Dye (Bronze)
|
||||
// dye009 DYE_SILVER Dye (Silver)
|
||||
// dye010 DYE_GREY Dye (Grey)
|
||||
// dye011 DYE_PINK Dye (Pink)
|
||||
// dye012 DYE_ORANGE Dye (Orange)
|
||||
// dye013 DYE_TAN Dye (Tan)
|
||||
// dye014 DYE_COPPER Dye (Copper)
|
||||
// dye015 DYE_WHITE Dye (White)
|
||||
// dye016 DYE_PLATINUM Dye (Platinum)
|
||||
// dye017 DYE_PURPLE Dye (Purple)
|
||||
// dye018 DYE_CHARCOAL Dye (Charcoal)
|
||||
// dye019 DYE_MINTGREEN Dye (Mint Green)
|
||||
// dye020 DYE_DARKRED Dye (Dark Red)
|
||||
// dye021 DYE_DARKGREEN Dye (Dark Green)
|
||||
// dye022 DYE_DARKBLUE Dye (Dark Blue)
|
||||
// dye023 DYE_PEACH Dye (Peach)
|
||||
// dye024 DYE_SMOKE Dye (Smoke)
|
||||
// dye025 DYE_FUSCHIA Dye (Fuschia)
|
||||
// dye026 DYE_OLIVE Dye (Olive)
|
||||
// dye027 DYE_YELLOWGRN Dye (Yellow-Green)
|
||||
// dye028 DYE_RUST Dye (Rust)
|
||||
// dye029 DYE_CHROMATIC Dye (Chromatic)
|
||||
// dye030 DYE_METALLIC Dye (Metallic)
|
||||
|
||||
// 000 Normal Wood -- Bow
|
||||
// 000 Olive
|
||||
// 100 Willow -- Bow
|
||||
// 100 Pine -- Bow
|
||||
// 100 Fir
|
||||
// 100 Mangrove
|
||||
// 200 Cherry -- Bow
|
||||
// 200 Maple
|
||||
// 250 Almond -- Bow
|
||||
// 300 Hickory -- Bow
|
||||
// 350 Birch -- Bow
|
||||
// 400 Elder -- Bow
|
||||
// 400 Walnut -- Bow
|
||||
// 450 Elm -- Bow
|
||||
// 500 Mahogany -- Bow
|
||||
// 500 Oak -- Bow
|
||||
// 550 Yew -- Bow
|
||||
// 600 Redwood -- Bow
|
||||
// 700 Ironwood -- Bow
|
||||
|
||||
|
||||
}
|
53
_module/nss/___tokens_used.nss
Normal file
53
_module/nss/___tokens_used.nss
Normal file
@@ -0,0 +1,53 @@
|
||||
void main()
|
||||
{
|
||||
|
||||
//*****************STRING TOKEN 10*****************
|
||||
//
|
||||
// ASCII CHAR 1-6 ===== COPPER PIECES
|
||||
// ASCII CHAR 7-12 ===== SILVER PIECES
|
||||
// ASCII CHAR 13-18 ===== ELECTRUM PIECES
|
||||
// ASCII CHAR 19-24 ===== PLATINUM PIECES
|
||||
// ASCII CHAR 25-26 ===== RESERVED
|
||||
|
||||
//******************PAIR TOKEN 14******************
|
||||
//
|
||||
// POSITION 1 ======== MINING SKILL
|
||||
// POSITION 2 ======== SMELTING SKILL
|
||||
// POSITION 3 ======== DIGGING SKILL
|
||||
// POSITION 4 ======== POTTERY/GLASS SKILL
|
||||
// POSITION 5 ======== TINKERING SKILL
|
||||
// POSITION 6 ======== FARMING SKILL
|
||||
// POSITION 7 ======== LUMBERJACK SKILL
|
||||
// POSITION 8 ======== SKINNING SKILL
|
||||
// POSITION 9 ======== PELT CURING SKILL
|
||||
// POSITION 10 ======== LEATHER TANNING SKILL
|
||||
// POSITION 11 ======== LEATHERWORKING SKILL
|
||||
// Position 12 ======== ALCHEMY SKILL
|
||||
// Position 13 ======== FISHING SKILL
|
||||
|
||||
//******************PAIR TOKEN 13******************
|
||||
//
|
||||
// POSITION 1 ======== BEEKEEPING SKILL
|
||||
// POSITION 2 ======== FLETCHING SKILL
|
||||
// POSITION 3 ======== BOWCRAFT SKILL
|
||||
// POSITION 4 ======== WEAPONSMITH SKILL
|
||||
// POSITION 5 ======== ARMORCRAFT SKILL
|
||||
// POSITION 6 ======== GEMPOLISHING SKILL
|
||||
// POSITION 7 ======== GEMCUTTING SKILL
|
||||
// POSITION 8 ======== GEM QUARRYING SKILL
|
||||
// POSITION 9 ======== TAILORING SKILL
|
||||
// POSITION 10 ======== SPINDLING SKILL
|
||||
// POSITION 11 ======== CLOTHMAKING SKILL
|
||||
// POSITION 12 ======== CLOTH DYEING SKILL
|
||||
// POSITION 13 ======== PAPER-MAKING SKILL
|
||||
|
||||
//******************PAIR TOKEN 12******************
|
||||
//
|
||||
// POSITION 1 ======== MUSHROOM SKILL (MYCOLOGY)
|
||||
// POSITION 2 ======== INSCRIPTION
|
||||
// POSITION 3 ======== COOKING
|
||||
// POSITION 4 ======== JEWELCRAFTING
|
||||
|
||||
|
||||
|
||||
}
|
97
_module/nss/_area_despawner.nss
Normal file
97
_module/nss/_area_despawner.nss
Normal file
@@ -0,0 +1,97 @@
|
||||
//#include "gz_inc_db"
|
||||
|
||||
void DestroyAllItems();
|
||||
int GetIsAreaOccupied(object oArea);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
// First check to see if the ExitingObject is a PC or not
|
||||
object oPC = GetExitingObject();
|
||||
|
||||
//Save player Status on exiting an area!
|
||||
//GTSavePlayerStatus(oPC);
|
||||
|
||||
// If not, we'll just exit
|
||||
if (!GetIsPC(oPC))
|
||||
return;
|
||||
|
||||
if ((!GetIsAreaOccupied(OBJECT_SELF)) && (GetIsPC(GetExitingObject())))
|
||||
{
|
||||
int Rounds = GetLocalInt(OBJECT_SELF, "PrepClean") + 1;
|
||||
SetLocalInt(OBJECT_SELF, "PrepClean", Rounds);
|
||||
Rounds = GetLocalInt(OBJECT_SELF, "PrepClean");
|
||||
DelayCommand(60.0, DestroyAllItems());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DestroyAllItems()
|
||||
{
|
||||
int Rounds = GetLocalInt(OBJECT_SELF, "PrepClean");
|
||||
if (!GetIsAreaOccupied(OBJECT_SELF))
|
||||
{
|
||||
// If this is in reaction to the most recent instance of a PC leaving the area, clean up.
|
||||
if (Rounds == 1)
|
||||
{
|
||||
object oItem = GetFirstObjectInArea(OBJECT_SELF);
|
||||
// When an NPC dies, they drop an object, not an item... like a treasure chest.
|
||||
while (oItem != OBJECT_INVALID)
|
||||
{
|
||||
if (GetIsEncounterCreature(oItem))
|
||||
DestroyObject(oItem);
|
||||
if (GetTag(oItem) == "BodyBag")
|
||||
{
|
||||
object oLookIn = GetFirstItemInInventory(oItem);
|
||||
// Destroy everything in it except plot items.
|
||||
while (oLookIn != OBJECT_INVALID)
|
||||
{
|
||||
//Set to delete plot items
|
||||
//if (!GetPlotFlag(oLookIn))
|
||||
DestroyObject(oLookIn);
|
||||
oLookIn = GetNextItemInInventory(oItem);
|
||||
}
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
else if ((GetObjectType(oItem) == OBJECT_TYPE_ITEM))
|
||||
DestroyObject(oItem);
|
||||
oItem = GetNextObjectInArea(OBJECT_SELF);
|
||||
}
|
||||
SetLocalInt(OBJECT_SELF, "PrepClean", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If this is not from the most recent instance of a PC leaving an area, decriment.
|
||||
Rounds--;
|
||||
SetLocalInt(OBJECT_SELF, "PrepClean", Rounds);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rounds--;
|
||||
SetLocalInt(OBJECT_SELF, "PrepClean", Rounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
This function returns TRUE if oArea currently
|
||||
has a PC in it and FALSE it doesn't.
|
||||
*Note: Returns FALSE if oArea is not valid.
|
||||
*/
|
||||
int GetIsAreaOccupied(object oArea)
|
||||
{
|
||||
if (GetIsObjectValid(oArea))
|
||||
{
|
||||
object oPlayer = GetFirstPC();
|
||||
while ((GetArea(oPlayer) != oArea) && (oPlayer != OBJECT_INVALID))
|
||||
oPlayer = GetNextPC();
|
||||
if (oPlayer != OBJECT_INVALID)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
4
_module/nss/_attack_gen.nss
Normal file
4
_module/nss/_attack_gen.nss
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
DoPlaceableObjectAction(GetNearestObjectByTag(GetLocalString(OBJECT_SELF,"sKillMe"),OBJECT_SELF,1),PLACEABLE_ACTION_BASH);
|
||||
}
|
6
_module/nss/_c_allow_delete.nss
Normal file
6
_module/nss/_c_allow_delete.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
SetLocalInt(oPC,AUTHORIZE,TRUE);
|
||||
}
|
29
_module/nss/_c_check_admin.nss
Normal file
29
_module/nss/_c_check_admin.nss
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "_c_inc_message"
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Name: _c_check_admin
|
||||
//:: Function: StartingConditional
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
/*
|
||||
"Cough"
|
||||
*/
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Created By: RagE aka Napalm-uk-RTW
|
||||
//:: Created On: 25/9/05
|
||||
//:: Copyright (c) 2002 *RTW* corp.
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
int StartingConditional()
|
||||
{
|
||||
string sMatch = GetMatchedSubstring(0);
|
||||
int nLength = GetStringLength(sMatch);
|
||||
|
||||
if(nLength < 1 || nLength > 500) {
|
||||
PlaySound("gui_error");
|
||||
return FALSE;
|
||||
|
||||
} else {
|
||||
|
||||
string sMessage = GetLocalString(OBJECT_SELF,M_BODY);
|
||||
SetCustomToken(2000,sMessage);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
31
_module/nss/_c_check_message.nss
Normal file
31
_module/nss/_c_check_message.nss
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "_c_inc_message"
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Name: _c_check_message
|
||||
//:: Function: StartingConditional
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
/*
|
||||
"Cough"
|
||||
*/
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Created By: RagE aka Napalm-uk-RTW
|
||||
//:: Created On: 25/9/05
|
||||
//:: Copyright (c) 2002 *RTW* corp.
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
int StartingConditional()
|
||||
{
|
||||
string sMatch = GetMatchedSubstring(0);
|
||||
int nLength = GetStringLength(sMatch);
|
||||
|
||||
if(nLength < 1 || nLength > 500) {
|
||||
PlaySound("gui_error");
|
||||
return FALSE;
|
||||
|
||||
} else {
|
||||
|
||||
string sMessage = GetLocalString(OBJECT_SELF,M_BODY);
|
||||
string sTitle = GetLocalString(OBJECT_SELF,M_TITLE);
|
||||
SetCustomToken(222,sMessage);
|
||||
SetCustomToken(111,sTitle);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
27
_module/nss/_c_check_player.nss
Normal file
27
_module/nss/_c_check_player.nss
Normal file
@@ -0,0 +1,27 @@
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Name: _c_check_player
|
||||
//:: Function: StartingConditional
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
/*
|
||||
DM's on the client can delete all message's
|
||||
without having there login's here. Add your
|
||||
player login to delete the message board if your
|
||||
not on the client.
|
||||
*/
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Created By: RagE aka Napalm-uk-RTW
|
||||
//:: Created On: 25/9/05
|
||||
//:: Copyright (c) 2002 *RTW* corp.
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
int StartingConditional()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
|
||||
if(GetIsDM(oPC) == TRUE ||
|
||||
GetPCPlayerName(oPC) == "---RagE---" ||
|
||||
GetPCPlayerName(oPC) == "" ||
|
||||
GetPCPlayerName(oPC) == "") {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
29
_module/nss/_c_check_poll.nss
Normal file
29
_module/nss/_c_check_poll.nss
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "_c_inc_message"
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Name: _c_check_poll
|
||||
//:: Function: StartingConditional
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
/*
|
||||
"Cough"
|
||||
*/
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Created By: RagE aka Napalm-uk-RTW
|
||||
//:: Created On: 25/9/05
|
||||
//:: Copyright (c) 2002 *RTW* corp.
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
int StartingConditional()
|
||||
{
|
||||
string sMatch = GetMatchedSubstring(0);
|
||||
int nLength = GetStringLength(sMatch);
|
||||
|
||||
if(nLength < 1 || nLength > 500) {
|
||||
PlaySound("gui_error");
|
||||
return FALSE;
|
||||
|
||||
} else {
|
||||
|
||||
string sMessage = GetLocalString(OBJECT_SELF,M_BODY);
|
||||
SetCustomToken(3000,sMessage);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
25
_module/nss/_c_check_title.nss
Normal file
25
_module/nss/_c_check_title.nss
Normal file
@@ -0,0 +1,25 @@
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Name: _c_check_title
|
||||
//:: Function: StartingConditional
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
/*
|
||||
Check the length of the Title being spoken if
|
||||
it's to longer than 30 letter's or empty
|
||||
return FALSE;
|
||||
*/
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Created By: RagE aka Napalm-uk-RTW
|
||||
//:: Created On: 25/9/05
|
||||
//:: Copyright (c) 2002 *RTW* corp.
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
int StartingConditional()
|
||||
{
|
||||
string sMatch = GetMatchedSubstring(0);
|
||||
int nLength = GetStringLength(sMatch);
|
||||
|
||||
if(nLength < 1 || nLength > 30) {
|
||||
PlaySound("gui_error");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
9
_module/nss/_c_clear_message.nss
Normal file
9
_module/nss/_c_clear_message.nss
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
int nIndex = GetDataBaseInt(_INDEX_);
|
||||
SetDataBaseInt(_PAGE_,nIndex);
|
||||
DeleteLocalString(OBJECT_SELF,M_TITLE);
|
||||
DeleteLocalString(OBJECT_SELF,M_BODY);
|
||||
|
||||
}
|
22
_module/nss/_c_color_token1.nss
Normal file
22
_module/nss/_c_color_token1.nss
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "_c_inc_message"
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Name: _c_color_token1
|
||||
//:: Function: StartingConditional
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
/*
|
||||
"Cough"
|
||||
*/
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Created By: RagE aka Napalm-uk-RTW
|
||||
//:: Created On: 25/9/05
|
||||
//:: Copyright (c) 2002 *RTW* corp.
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
int StartingConditional()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
ColourTokens();
|
||||
if(GetLocalInt(oPC,"AUTHORIZE") == TRUE) {
|
||||
SetLocalInt(oPC,"AUTHORIZE",FALSE);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
3
_module/nss/_c_delete_1.nss
Normal file
3
_module/nss/_c_delete_1.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(1,nPage); }
|
3
_module/nss/_c_delete_10.nss
Normal file
3
_module/nss/_c_delete_10.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(10,nPage); }
|
3
_module/nss/_c_delete_2.nss
Normal file
3
_module/nss/_c_delete_2.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(2,nPage); }
|
3
_module/nss/_c_delete_3.nss
Normal file
3
_module/nss/_c_delete_3.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(3,nPage); }
|
3
_module/nss/_c_delete_4.nss
Normal file
3
_module/nss/_c_delete_4.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(4,nPage); }
|
3
_module/nss/_c_delete_5.nss
Normal file
3
_module/nss/_c_delete_5.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(5,nPage); }
|
3
_module/nss/_c_delete_6.nss
Normal file
3
_module/nss/_c_delete_6.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(6,nPage); }
|
3
_module/nss/_c_delete_7.nss
Normal file
3
_module/nss/_c_delete_7.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(7,nPage); }
|
3
_module/nss/_c_delete_8.nss
Normal file
3
_module/nss/_c_delete_8.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(8,nPage); }
|
3
_module/nss/_c_delete_9.nss
Normal file
3
_module/nss/_c_delete_9.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);DeleteMessage(9,nPage); }
|
5
_module/nss/_c_delete_db.nss
Normal file
5
_module/nss/_c_delete_db.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
DeleteMessageType(1);
|
||||
}
|
5
_module/nss/_c_delete_server.nss
Normal file
5
_module/nss/_c_delete_server.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
DeleteMessageType(2);
|
||||
}
|
5
_module/nss/_c_delete_vote.nss
Normal file
5
_module/nss/_c_delete_vote.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
DeleteMessageType(3);
|
||||
}
|
409
_module/nss/_c_inc_message.nss
Normal file
409
_module/nss/_c_inc_message.nss
Normal file
@@ -0,0 +1,409 @@
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Name: _c_inc_message
|
||||
//:: Function: include for RagE's Message Board
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
/*
|
||||
This include script will not compile!!
|
||||
I've scripted this to the best of my ability's!
|
||||
It's by no mean's the best or most efficient way to script this Message board
|
||||
as my scripting skill's are still limited but i gave it a go :D
|
||||
If you make any change's in here make sure to recompile your module.
|
||||
Any alteration of this script is allowed as long as you include the copyright
|
||||
notice & Author's name in any redistribution of this code.
|
||||
|
||||
///- Update's -///
|
||||
|
||||
A thank's to (pspeed) & his Z-Dialog System for giving me some idea's!!!
|
||||
Ok this will proberbly be the last update unless any bug's are found
|
||||
finger's crossed lol. Anyway some small alteration's and fix's from the
|
||||
previous version. You can now store an unlimited amount of post
|
||||
to the message board. For people who use this in large server's might
|
||||
experience some lag when adding a message as the NWN Database is quite slow.
|
||||
*/
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Created By: RagE aka Napalm-uk-RTW
|
||||
//:: Created On: 25/9/05
|
||||
//:: Copyright (c) 2002 *RTW* corp.
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
// - UPDATED Version 3.0
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
//* *RagE* * //
|
||||
//* MESSAGE BOARD v3.0 * //
|
||||
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// - You can alter these DataBase name's if needed if any conflit's occur with
|
||||
// - other DataBase's in your module
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//-----------------------CONSTANTS-DATABASE-NAMES-----------------------------//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const string M_MB_DB = "MSGBD_DB"; // - Message Board Main Database //
|
||||
const string _INDEX_ = "_INDEX_"; // - Store current page number //
|
||||
const string _PAGE_ = "_PAGE_"; // - View and set page _PAGE_+(No.) //
|
||||
const string M_ADMIN = "M_ADMIN"; // - Admin message entry //
|
||||
const string M_POLL = "M_POLL"; // - Poll question entry //
|
||||
const string M_YES = "M_YES"; // - Vote no entry //
|
||||
const string M_NO = "M_NO"; // - Vote yes entry //
|
||||
const string M_VOTED = "M_VOTED"; // - Check has voted //
|
||||
const string M_TITLE = "M_TITLE"; // - Scribe title entry //
|
||||
const string M_BODY = "M_BODY"; // - Scribe body entry //
|
||||
const string M_TITLE_ = "M_TITLE_"; // - Message board title M_TITLE_+(No.)//
|
||||
const string M_BODY_ = "M_BODY_"; // - Message board body M_BODY_+(No.) //
|
||||
const string M_HIT = "M_HIT"; // - Message board hit rating //
|
||||
const string M_COUNT = "M_COUNT"; // - Message count reset //
|
||||
const string M_NAME = "M_NAME"; // - Name of the last poster //
|
||||
const string AUTHORIZE = "AUTHORIZE";// - Allow DM to delete a message //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//-------------------------------FUNCTIONS------------------------------------//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// - SetCampaignInt Wrapper
|
||||
void SetDataBaseInt(string sDataName,int nData);
|
||||
// - SetCampaignString Wrapper
|
||||
void SetDataBaseString(string sDataName,string sData);
|
||||
// - GetCampaignString Wrapper
|
||||
string GetDataBaseString(string sDataName);
|
||||
// - GetCampaignInt Wrapper
|
||||
int GetDataBaseInt(string sDataName);
|
||||
// - Veiw nMessage at nPage on the message board
|
||||
int ShowMessage(int nMessage,int nPage);
|
||||
// - Cast vote and store it
|
||||
void CastVote(int nVote);
|
||||
// - Delete a specific message on the message board
|
||||
void DeleteMessage(int nMessage,int nPage);
|
||||
// - Delete message nType
|
||||
void DeleteMessageType(int nType);
|
||||
// - Sware word filter function
|
||||
void SwareFilter();
|
||||
// - Store's the message Title to Temporary Database - "M_TITLE"
|
||||
void SetMessageTitle();
|
||||
// - Store's the message Body to Temporary Database - "M_BODY"
|
||||
void SetMessageBody();
|
||||
// - Store's the server message to Temporary Database - "M_BODY"
|
||||
void SetAdminMessage();
|
||||
// - Store's a message to the message board
|
||||
void AddPost();
|
||||
// - Store server message to the message board
|
||||
void AddAdminPost();
|
||||
// - Store poll question to the message board
|
||||
void AddPollPost();
|
||||
// - Text colour Token's
|
||||
void ColourTokens();
|
||||
// - Random Text
|
||||
void Profanity();
|
||||
// - Veiw server message
|
||||
int ShowAdminMessage();
|
||||
// - Veiw poll question
|
||||
int ShowPollMessage();
|
||||
// - View poll results
|
||||
int ShowVoteResults();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------IMPLEMENTATION----------------------------------//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SetDataBaseInt(string sDataName,int nData)
|
||||
{
|
||||
SetCampaignInt(M_MB_DB,sDataName,nData);
|
||||
}
|
||||
|
||||
int GetDataBaseInt(string sDataName)
|
||||
{
|
||||
return GetCampaignInt(M_MB_DB,sDataName);
|
||||
}
|
||||
|
||||
void SetDataBaseString(string sDataName,string sData)
|
||||
{
|
||||
SetCampaignString(M_MB_DB,sDataName,sData);
|
||||
}
|
||||
|
||||
string GetDataBaseString(string sDataName)
|
||||
{
|
||||
return GetCampaignString(M_MB_DB,sDataName);
|
||||
}
|
||||
|
||||
void DeleteMessageType(int nType)
|
||||
{
|
||||
if(nType == 1) {
|
||||
DestroyCampaignDatabase(M_MB_DB);
|
||||
} else if(nType == 2) {
|
||||
DeleteCampaignVariable(M_MB_DB,M_ADMIN);
|
||||
} else if(nType == 3) {
|
||||
SetDataBaseInt(M_YES,0);
|
||||
SetDataBaseInt(M_NO,0);
|
||||
DeleteCampaignVariable(M_MB_DB,M_POLL);
|
||||
DeleteCampaignVariable(M_MB_DB,M_VOTED);
|
||||
}
|
||||
PlaySound("gui_magbag_full");
|
||||
}
|
||||
|
||||
void DeleteMessage(int nMessage,int nPage)
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
if(GetLocalInt(oPC,AUTHORIZE) == TRUE) {
|
||||
SetCustomToken(8500+nMessage,"<c<>>**Deleted**");
|
||||
SetDataBaseString(M_TITLE_+IntToString(nMessage)+_PAGE_+IntToString(nPage),"<c<>>**Deleted**");
|
||||
SetDataBaseString(M_BODY_+IntToString(nMessage)+_PAGE_+IntToString(nPage),"<c<>>**Deleted**");
|
||||
SetLocalInt(oPC,AUTHORIZE,FALSE);
|
||||
PlaySound("gui_magbag_full");
|
||||
}
|
||||
}
|
||||
|
||||
void CastVote(int nVote)
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nNo = GetDataBaseInt(M_NO);
|
||||
int nYes = GetDataBaseInt(M_YES);
|
||||
int nVoted = GetCampaignInt(M_MB_DB,M_VOTED,oPC);
|
||||
|
||||
if(nVoted == TRUE) {
|
||||
PlaySound("gui_error");
|
||||
FloatingTextStringOnCreature("You have already cast your vote in this poll",oPC);
|
||||
return;
|
||||
} else if(nVote == 1) {
|
||||
++nYes;
|
||||
SetDataBaseInt(M_YES,nYes);
|
||||
SetCampaignInt(M_MB_DB,M_VOTED,TRUE,oPC);
|
||||
} else if(nVote == 2) {
|
||||
++nNo;
|
||||
SetDataBaseInt(M_NO,nNo);
|
||||
SetCampaignInt(M_MB_DB,M_VOTED,TRUE,oPC);
|
||||
}
|
||||
PlaySound("gui_journaladd");
|
||||
}
|
||||
|
||||
void SetMessageTitle()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nListen = GetListenPatternNumber();
|
||||
string sName = GetPCPlayerName(oPC);
|
||||
string sTitle = GetMatchedSubstring(0);
|
||||
|
||||
if(nListen == 1000 && GetIsPC(oPC))
|
||||
{
|
||||
if(GetStringLength(sTitle) > 30)
|
||||
{
|
||||
sTitle = GetStringLeft(sTitle,30);
|
||||
SpeakString("Maximum Title length is 30 character's");
|
||||
PlaySound("gui_error");
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
string sSay = "<c<><63><EFBFBD>>"+sTitle+"<c<01>> By:<c<><63><EFBFBD>> ("+sName+")</c>\n";
|
||||
SetLocalString(OBJECT_SELF,M_TITLE,sSay);
|
||||
SwareFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetMessageBody()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nListen = GetListenPatternNumber();
|
||||
string sBody = GetMatchedSubstring(0);
|
||||
string sDate = IntToString(GetCalendarDay())+"/"+IntToString(GetCalendarMonth())+"/"+IntToString(GetCalendarYear());
|
||||
string sTime = IntToString(GetTimeHour())+":"+IntToString(GetTimeMinute());
|
||||
string sSay;
|
||||
|
||||
if(nListen == 1000 && GetIsPC(oPC))
|
||||
{
|
||||
if(GetStringLength(sBody) > 500)
|
||||
{
|
||||
sBody = GetStringLeft(sBody,500);
|
||||
SpeakString("Maximum Message length is 500 character's");
|
||||
PlaySound("gui_error");
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
sSay += "<c<01>>Date: <c<><63><EFBFBD>>"+sDate+" <c<01>>Time: <c<><63><EFBFBD>>"+sTime+"\n";
|
||||
sSay += "<c<>>-------------------------------------------\n";
|
||||
sSay += "<c<><63><EFBFBD>>"+sBody+"\n";
|
||||
sSay += "<c<>>-------------------------------------------\n";
|
||||
|
||||
SetLocalString(OBJECT_SELF,M_BODY,sSay);
|
||||
SwareFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetAdminMessage()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nListen = GetListenPatternNumber();
|
||||
string sBody = GetMatchedSubstring(0);
|
||||
string sSay;
|
||||
|
||||
if(nListen == 1000 && GetIsPC(oPC))
|
||||
{
|
||||
if(GetStringLength(sBody) > 500)
|
||||
{
|
||||
sBody = GetStringLeft(sBody,500);
|
||||
SpeakString("Maximum Message length is 500 character's");
|
||||
PlaySound("gui_error");
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
sSay += "<c<>>-------------------------------------------\n";
|
||||
sSay += "<c<><63><EFBFBD>>"+sBody+"\n";
|
||||
sSay += "<c<>>-------------------------------------------\n";
|
||||
|
||||
SetLocalString(OBJECT_SELF,M_BODY,sSay);
|
||||
SwareFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string RandomSpeak(int nRandom)
|
||||
{
|
||||
switch(nRandom)
|
||||
{
|
||||
case 1:
|
||||
return "Didn't your mother ever teach you manner's?";
|
||||
case 2:
|
||||
return "Your english is very good";
|
||||
case 3:
|
||||
return "Did you goto Cambridge?";
|
||||
case 4:
|
||||
return "Wash your mouth out!";
|
||||
case 5:
|
||||
return "How dare you use language like that!!";
|
||||
}
|
||||
return ">.<";
|
||||
}
|
||||
void Profanity()
|
||||
{
|
||||
int nRandom = Random(5);
|
||||
string sString = RandomSpeak(nRandom);
|
||||
SpeakString(sString);
|
||||
}
|
||||
|
||||
void SwareFilter()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
string sFilter = "**(wanker|cunt|shit|cock|fuck|dick|prick|pussy|bitch|gay|faggot|nigger|pakki)**";
|
||||
string sSaid = GetMatchedSubstring(0);
|
||||
|
||||
if(TestStringAgainstPattern(sFilter,sSaid))
|
||||
{
|
||||
Profanity();
|
||||
AssignCommand(OBJECT_SELF,ActionStartConversation(oPC,"_c_message_s"));
|
||||
DeleteLocalString(OBJECT_SELF,M_TITLE);
|
||||
DeleteLocalString(OBJECT_SELF,M_BODY);
|
||||
PlaySound("gui_error");
|
||||
}
|
||||
}
|
||||
|
||||
void ColourTokens()
|
||||
{
|
||||
SetCustomToken(1000,"<c<><63><EFBFBD>>"); //White
|
||||
SetCustomToken(1001,"<c<>>"); //Red
|
||||
SetCustomToken(1002,"<c<01>>"); //Green
|
||||
SetCustomToken(1003,"<c<><63><EFBFBD>>"); //Silver
|
||||
SetCustomToken(1004,"<c<01>>"); //Blue
|
||||
SetCustomToken(1005,"<c<><63>>"); //Yellow
|
||||
}
|
||||
|
||||
void AddAdminPost()
|
||||
{
|
||||
string sPost = GetLocalString(OBJECT_SELF,M_BODY);
|
||||
SetDataBaseString(M_ADMIN,sPost);
|
||||
}
|
||||
|
||||
void AddPollPost()
|
||||
{
|
||||
string sPost = GetLocalString(OBJECT_SELF,M_BODY);
|
||||
SetDataBaseString(M_POLL,sPost);
|
||||
SetDataBaseInt(M_YES,0);
|
||||
SetDataBaseInt(M_NO,0);
|
||||
DeleteCampaignVariable(M_MB_DB,M_VOTED);
|
||||
}
|
||||
|
||||
void AddPost()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nIndex = GetDataBaseInt(_INDEX_);
|
||||
int nCount = GetDataBaseInt(M_COUNT);
|
||||
int nPage = GetDataBaseInt(_PAGE_);
|
||||
string sTitle = GetLocalString(OBJECT_SELF,M_TITLE);
|
||||
string sBody = GetLocalString(OBJECT_SELF,M_BODY);
|
||||
|
||||
if(nCount >= 10)
|
||||
{
|
||||
++nPage;
|
||||
++nIndex;
|
||||
SetDataBaseInt(M_COUNT,1);
|
||||
SetDataBaseInt(_PAGE_,nPage);
|
||||
SetDataBaseInt(_INDEX_,nIndex);
|
||||
SetDataBaseString(M_TITLE_+IntToString(1)+_PAGE_+IntToString(nIndex),sTitle);
|
||||
SetDataBaseString(M_BODY_+IntToString(1)+_PAGE_+IntToString(nIndex),sBody);
|
||||
|
||||
} else {
|
||||
|
||||
++nCount;
|
||||
SetDataBaseInt(M_COUNT,nCount);
|
||||
SetDataBaseString(M_TITLE_+IntToString(nCount)+_PAGE_+IntToString(nIndex),sTitle);
|
||||
SetDataBaseString(M_BODY_+IntToString(nCount)+_PAGE_+IntToString(nIndex),sBody);
|
||||
}
|
||||
SetDataBaseString(M_NAME,"<c<><63><EFBFBD>>("+GetPCPlayerName(oPC)+")");
|
||||
}
|
||||
|
||||
int ShowVoteResults()
|
||||
{
|
||||
int nYes = GetDataBaseInt(M_YES);
|
||||
int nNo = GetDataBaseInt(M_NO);
|
||||
SetCustomToken(4000,"<c<>>(<c<><63><EFBFBD>>"+IntToString(nYes)+"<c<>>)");
|
||||
SetCustomToken(5000,"<c<>>(<c<><63><EFBFBD>>"+IntToString(nNo)+"<c<>>)");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int ShowMessage(int nMessage,int nPage)
|
||||
{
|
||||
string sMessage = GetDataBaseString(M_BODY_+IntToString(nMessage)+_PAGE_+IntToString(nPage));
|
||||
string sTitle = GetDataBaseString(M_TITLE_+IntToString(nMessage)+_PAGE_+IntToString(nPage));
|
||||
|
||||
if(sTitle != "") {
|
||||
SetCustomToken(8500+nMessage,sMessage);
|
||||
SetCustomToken(7500+nMessage,sTitle);
|
||||
return TRUE;
|
||||
|
||||
} else {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int ShowPollMessage()
|
||||
{
|
||||
string sMessage = GetDataBaseString(M_POLL);
|
||||
|
||||
if(sMessage != "") {
|
||||
SetCustomToken(3000,sMessage);
|
||||
return TRUE;
|
||||
|
||||
} else {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int ShowAdminMessage()
|
||||
{
|
||||
string sMessage = GetDataBaseString(M_ADMIN);
|
||||
|
||||
if(sMessage != "") {
|
||||
SetCustomToken(2000,sMessage);
|
||||
return TRUE;
|
||||
|
||||
} else {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void main(){}
|
5
_module/nss/_c_listen_scribe.nss
Normal file
5
_module/nss/_c_listen_scribe.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
void main()
|
||||
{
|
||||
SetListening(OBJECT_SELF,TRUE);
|
||||
SetListenPattern(OBJECT_SELF,"**",1000);
|
||||
}
|
3
_module/nss/_c_message_1.nss
Normal file
3
_module/nss/_c_message_1.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(1,nPage); }
|
3
_module/nss/_c_message_10.nss
Normal file
3
_module/nss/_c_message_10.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(10,nPage); }
|
3
_module/nss/_c_message_2.nss
Normal file
3
_module/nss/_c_message_2.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(2,nPage); }
|
3
_module/nss/_c_message_3.nss
Normal file
3
_module/nss/_c_message_3.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(3,nPage); }
|
3
_module/nss/_c_message_4.nss
Normal file
3
_module/nss/_c_message_4.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(4,nPage); }
|
3
_module/nss/_c_message_5.nss
Normal file
3
_module/nss/_c_message_5.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(5,nPage); }
|
3
_module/nss/_c_message_6.nss
Normal file
3
_module/nss/_c_message_6.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(6,nPage); }
|
3
_module/nss/_c_message_7.nss
Normal file
3
_module/nss/_c_message_7.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(7,nPage);}
|
3
_module/nss/_c_message_8.nss
Normal file
3
_module/nss/_c_message_8.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(8,nPage); }
|
3
_module/nss/_c_message_9.nss
Normal file
3
_module/nss/_c_message_9.nss
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{ int nPage = GetDataBaseInt(_PAGE_);return ShowMessage(9,nPage); }
|
5
_module/nss/_c_message_admin.nss
Normal file
5
_module/nss/_c_message_admin.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{
|
||||
return ShowAdminMessage();
|
||||
}
|
5
_module/nss/_c_message_poll.nss
Normal file
5
_module/nss/_c_message_poll.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{
|
||||
return ShowPollMessage();
|
||||
}
|
17
_module/nss/_c_page_back.nss
Normal file
17
_module/nss/_c_page_back.nss
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nPage = GetDataBaseInt(_PAGE_);
|
||||
|
||||
if(nPage < 1) {
|
||||
FloatingTextStringOnCreature("End of List",oPC);
|
||||
PlaySound("gui_error");
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
--nPage;
|
||||
SetDataBaseInt(_PAGE_,nPage);
|
||||
}
|
||||
}
|
19
_module/nss/_c_page_forward.nss
Normal file
19
_module/nss/_c_page_forward.nss
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nIndex = GetDataBaseInt(_INDEX_);
|
||||
int nPage = GetDataBaseInt(_PAGE_);
|
||||
|
||||
if(nPage >= nIndex) {
|
||||
FloatingTextStringOnCreature("End of List",oPC);
|
||||
PlaySound("gui_error");
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
++nPage;
|
||||
SetDataBaseInt(_PAGE_,nPage);
|
||||
}
|
||||
}
|
||||
|
4
_module/nss/_c_scribe_post.nss
Normal file
4
_module/nss/_c_scribe_post.nss
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
ActionMoveToObject(GetNearestObjectByTag("POST_"+GetTag(OBJECT_SELF)));
|
||||
}
|
5
_module/nss/_c_set_admin.nss
Normal file
5
_module/nss/_c_set_admin.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
SetAdminMessage();
|
||||
}
|
5
_module/nss/_c_set_body.nss
Normal file
5
_module/nss/_c_set_body.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
SetMessageBody();
|
||||
}
|
24
_module/nss/_c_set_menu.nss
Normal file
24
_module/nss/_c_set_menu.nss
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "_c_inc_message"
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Name: _c_set_menu
|
||||
//:: Function: StartingConditional
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
/*
|
||||
"Cough"
|
||||
*/
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
//:: Created By: RagE aka Napalm-uk-RTW
|
||||
//:: Created On: 25/9/05
|
||||
//:: Copyright (c) 2002 *RTW* corp.
|
||||
//><><><><><><><><><><><><><><><><><><><><><><><><>*
|
||||
int StartingConditional()
|
||||
{
|
||||
int nHit = GetLocalInt(OBJECT_SELF,M_HIT);
|
||||
int nIndex = GetDataBaseInt(_INDEX_)+1;
|
||||
int nPage = GetDataBaseInt(_PAGE_)+1;
|
||||
string sName = GetDataBaseString(M_NAME);
|
||||
SetCustomToken(112,"<c<><63><EFBFBD>>"+sName);
|
||||
SetCustomToken(111,"<c<><63><EFBFBD>>"+IntToString(nHit));
|
||||
SetCustomToken(100,"<c<><63><EFBFBD>>"+IntToString(nPage)+"<c<01>> of <c<><63><EFBFBD>>"+IntToString(nIndex));
|
||||
return TRUE;
|
||||
}
|
5
_module/nss/_c_set_poll.nss
Normal file
5
_module/nss/_c_set_poll.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
AddPollPost();
|
||||
}
|
5
_module/nss/_c_set_title.nss
Normal file
5
_module/nss/_c_set_title.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
SetMessageTitle();
|
||||
}
|
5
_module/nss/_c_show_results.nss
Normal file
5
_module/nss/_c_show_results.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
int StartingConditional()
|
||||
{
|
||||
return ShowVoteResults();
|
||||
}
|
16
_module/nss/_c_start_conv.nss
Normal file
16
_module/nss/_c_start_conv.nss
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastUsedBy();
|
||||
|
||||
if(GetIsPC(oPC))
|
||||
{
|
||||
int nIndex = GetDataBaseInt(_INDEX_);
|
||||
SetDataBaseInt(_PAGE_,nIndex);
|
||||
int nHit = GetLocalInt(OBJECT_SELF,M_HIT);
|
||||
++nHit;
|
||||
SetLocalInt(OBJECT_SELF,M_HIT,nHit);
|
||||
AssignCommand(oPC,ClearAllActions(TRUE));
|
||||
AssignCommand(OBJECT_SELF,ActionStartConversation(oPC,"_c_message_b",TRUE,FALSE));
|
||||
}
|
||||
}
|
5
_module/nss/_c_store_admin.nss
Normal file
5
_module/nss/_c_store_admin.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
AddAdminPost();
|
||||
}
|
5
_module/nss/_c_store_message.nss
Normal file
5
_module/nss/_c_store_message.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
AddPost();
|
||||
}
|
5
_module/nss/_c_store_post.nss
Normal file
5
_module/nss/_c_store_post.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
AddPollPost();
|
||||
}
|
5
_module/nss/_c_vote_no.nss
Normal file
5
_module/nss/_c_vote_no.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
CastVote(2);
|
||||
}
|
5
_module/nss/_c_vote_yes.nss
Normal file
5
_module/nss/_c_vote_yes.nss
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "_c_inc_message"
|
||||
void main()
|
||||
{
|
||||
CastVote(1);
|
||||
}
|
38
_module/nss/_cb_client_enter.nss
Normal file
38
_module/nss/_cb_client_enter.nss
Normal file
@@ -0,0 +1,38 @@
|
||||
//ColdBlade
|
||||
//Client Enter event
|
||||
//Copyright (c) 2002 by Coldblade
|
||||
//V2.0.0
|
||||
//-------------------------------------------------
|
||||
//This is also in the Client Enter, to setup the varriables for first level untill
|
||||
//the player levelup atleast onice in the game. This is for the half-dragon, as we know
|
||||
//the half-dragon increase the player hitdice, aka a thief with d6 would become d8
|
||||
//to a maxminum of d12. so that means barbarns are out. This version has quite a
|
||||
//bit of workaround to get around the muliclass ability of the player just making
|
||||
//one check and kicking him out wouldn't be fair if he's a say barbarn/wizard muliclass
|
||||
//cos the wizard will still legaly deserve the hitdice increase. Well not a lots
|
||||
//of workaround but it took me a few min to think and plan the whole thing out :)
|
||||
#include "_cb_core"
|
||||
|
||||
void main()
|
||||
{
|
||||
object cbObject = GetEnteringObject();
|
||||
object oMod = GetModule();
|
||||
if(!GetIsDM(cbObject))
|
||||
{
|
||||
SetLocalInt(cbObject, "CB_ITEM", 0);
|
||||
SetLocalInt(cbObject, "CB_DRAGON", 0);
|
||||
SetLocalInt(cbObject, "CB_OLD1", 0);
|
||||
SetLocalInt(cbObject, "CB_OLD2", 0);
|
||||
SetLocalInt(cbObject, "CB_OLD3", 0);
|
||||
SetLocalInt(cbObject, "CB_CHECK", 0);
|
||||
SetLocalInt(cbObject, "CB_DAYNIGHT", 0);
|
||||
SetLocalInt(cbObject, "O3_ECL_XP_ONE_SECOND_AGO", 0);
|
||||
int ECL = core(cbObject);
|
||||
SetLocalInt(cbObject, "CB_ECL", ECL);
|
||||
}
|
||||
if(GetLocalInt(oMod, "CB_EXECUTE") != 1)
|
||||
{
|
||||
ExecuteScript("_cb_ecl", oMod);
|
||||
SetLocalInt(oMod, "CB_EXECUTE", 1);
|
||||
}
|
||||
}
|
76
_module/nss/_cb_core.nss
Normal file
76
_module/nss/_cb_core.nss
Normal file
@@ -0,0 +1,76 @@
|
||||
//ColdBlade
|
||||
//Core Function
|
||||
//Copyright (c) 2002 by Coldblade
|
||||
//V2.5.0
|
||||
//-------------------------------------------------
|
||||
//Jumped to version 2.5.0 because this would be a major core code rewrite.
|
||||
//I have decided to separe the orginal three function from the Version 1.0.0
|
||||
//into three separe files, one being the Raise/Lower Stats and Skills Include
|
||||
//file, the other one would be the Subrace and Templates Include, Then the final
|
||||
//file is the core which is this one, this file is to determite which function
|
||||
//to call, and it probably will get altered a lots that's why i separed the
|
||||
//subrace and templates, and raise/lower stats function/includes from the core
|
||||
//to easern the change and make it imho more newbie friendly, to add new subrace
|
||||
//or template all the newbie got to do is add it to the bottom of the subrace
|
||||
//files, then provide a way for the core to call it and bam his work is done.
|
||||
|
||||
//when altering my name for relase be sure to change and correct the #includes.
|
||||
#include "_cb_subrace"
|
||||
|
||||
//Template Function
|
||||
int template(object cbObject, string cbPCsubrace)
|
||||
{
|
||||
int ECL = 0;
|
||||
if(TestStringAgainstPattern("**AASIMAR**", cbPCsubrace)) ECL = aasimar(cbObject);
|
||||
if(TestStringAgainstPattern("**TIEFLING**", cbPCsubrace)) ECL = tiefling(cbObject);
|
||||
if(TestStringAgainstPattern("**AIR**", cbPCsubrace)) ECL = air(cbObject);
|
||||
if(TestStringAgainstPattern("**EARTH**", cbPCsubrace)) ECL = earth(cbObject);
|
||||
if(TestStringAgainstPattern("**WATER**", cbPCsubrace)) ECL = water(cbObject);
|
||||
if(TestStringAgainstPattern("**FIRE**", cbPCsubrace)) ECL = fire(cbObject);
|
||||
if(TestStringAgainstPattern("**CELESTIAL**", cbPCsubrace)) ECL = celestial(cbObject);
|
||||
if(TestStringAgainstPattern("**FIENDISH**", cbPCsubrace)) ECL = fiendish(cbObject);
|
||||
if(TestStringAgainstPattern("**HALF-CELESTIAL**", cbPCsubrace)) ECL = halfcelestial(cbObject);
|
||||
if((TestStringAgainstPattern("**HALF-FIEND**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**FIEND**", cbPCsubrace))) ECL = halffiend(cbObject);
|
||||
if((TestStringAgainstPattern("**HALF-DRAGON**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**DRAGON**", cbPCsubrace))) ECL = halfdragon(cbObject);
|
||||
return ECL;
|
||||
}
|
||||
|
||||
int core(object cbObject)
|
||||
{
|
||||
int cbPCrace = GetRacialType(cbObject);
|
||||
string cbPCsubrace = GetStringUpperCase(GetSubRace(cbObject));
|
||||
int cbECL = 0;
|
||||
switch(cbPCrace)
|
||||
{
|
||||
case RACIAL_TYPE_HUMAN: break;
|
||||
case RACIAL_TYPE_HALFORC: break;
|
||||
case RACIAL_TYPE_HALFELF: break;
|
||||
case RACIAL_TYPE_HALFLING:
|
||||
if(TestStringAgainstPattern("**GHOSTWISE**", cbPCsubrace)) cbECL = ghostwise(cbObject);
|
||||
if(TestStringAgainstPattern("**LIGHTFOOT**", cbPCsubrace)) cbECL = lightfoot(cbObject);
|
||||
if(TestStringAgainstPattern("**STRONGHEART**", cbPCsubrace)) cbECL = strongheart(cbObject);
|
||||
break;
|
||||
case RACIAL_TYPE_DWARF:
|
||||
if(TestStringAgainstPattern("**GOLD**", cbPCsubrace)) cbECL = gold(cbObject);
|
||||
if(TestStringAgainstPattern("**SHIELD**", cbPCsubrace)) cbECL = shield(cbObject);
|
||||
if((TestStringAgainstPattern("**GRAY**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**DUERGAR**", cbPCsubrace))) cbECL = gray(cbObject);
|
||||
break;
|
||||
case RACIAL_TYPE_ELF:
|
||||
if((TestStringAgainstPattern("**DROW**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**DARK**", cbPCsubrace))) cbECL = drow(cbObject);
|
||||
if(TestStringAgainstPattern("**WILD**", cbPCsubrace)) cbECL = wild(cbObject);
|
||||
if(TestStringAgainstPattern("**MOON**", cbPCsubrace)) cbECL = moon(cbObject);
|
||||
if(TestStringAgainstPattern("**SUN**", cbPCsubrace)) cbECL = sun(cbObject);
|
||||
if(TestStringAgainstPattern("**WOOD**", cbPCsubrace)) cbECL = wood(cbObject);
|
||||
break;
|
||||
case RACIAL_TYPE_GNOME:
|
||||
if(TestStringAgainstPattern("**ROCK**", cbPCsubrace)) cbECL = rock(cbObject);
|
||||
if((TestStringAgainstPattern("**DEEP**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**SVIRFNEBLIN**", cbPCsubrace))) cbECL = deep(cbObject);
|
||||
break;
|
||||
}
|
||||
return (cbECL + template(cbObject, cbPCsubrace));
|
||||
}
|
1
_module/nss/_cb_ecl.nss
Normal file
1
_module/nss/_cb_ecl.nss
Normal file
@@ -0,0 +1 @@
|
||||
|
109
_module/nss/_cb_heartbeat.nss
Normal file
109
_module/nss/_cb_heartbeat.nss
Normal file
@@ -0,0 +1,109 @@
|
||||
#include "_cb_core"
|
||||
|
||||
void main()
|
||||
{
|
||||
object cbObject = GetFirstPC();
|
||||
int cbPCrace = GetRacialType(cbObject);
|
||||
string cbPCsubrace = GetStringUpperCase(GetSubRace(cbObject));
|
||||
|
||||
while(cbObject != OBJECT_INVALID)
|
||||
{
|
||||
if(!GetIsDM(cbObject))
|
||||
{
|
||||
//in the orginal heartbeat i had a ECL adjustment script here but
|
||||
//i figured out a better methoid i think so i'm moving it there.
|
||||
if(GetIsDay() || GetIsDawn())
|
||||
{
|
||||
if(cbPCrace == RACIAL_TYPE_DWARF)
|
||||
{
|
||||
if((TestStringAgainstPattern("**GRAY**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**DUERGAR**", cbPCsubrace)))
|
||||
{
|
||||
if(GetLocalInt(cbObject, "CB_DAYNIGHT") != 1)
|
||||
{
|
||||
attack(2, 3, cbObject, FALSE);
|
||||
savingthrow(4, 2, 21, cbObject, FALSE);
|
||||
skills(2, 21, cbObject, FALSE);
|
||||
SetLocalInt(cbObject, "CB_DAYNIGHT", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cbPCrace == RACIAL_TYPE_ELF)
|
||||
{
|
||||
if((TestStringAgainstPattern("**DROW**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**DARK**", cbPCsubrace)))
|
||||
{
|
||||
if(GetLocalInt(cbObject, "CB_DAYNIGHT") != 1)
|
||||
{
|
||||
attack(1, 3, cbObject, FALSE);
|
||||
savingthrow(4, 1, 21, cbObject, FALSE);
|
||||
skills(1, 21, cbObject, FALSE);
|
||||
//the blinding is wrong its goign to be temponary but it should only be 1 round and
|
||||
//if certain bright spells are cast the drow should go blind for a round so need to
|
||||
//work on this, Right now i'll just have drow going blind when its first become bright.
|
||||
//but later i'll alter this and all of the bright light spell like daylight for example.
|
||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,SupernaturalEffect(EffectBlindness()), cbObject, 6.0);
|
||||
SetLocalInt(cbObject, "CB_DAYNIGHT", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cbPCrace == RACIAL_TYPE_GNOME)
|
||||
{
|
||||
if((TestStringAgainstPattern("**DEEP**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**SVIRFNEBLIN**", cbPCsubrace)))
|
||||
{
|
||||
if(GetLocalInt(cbObject, "CB_DAYNIGHT") != 1)
|
||||
{
|
||||
skills(2, 6, cbObject, FALSE);
|
||||
SetLocalInt(cbObject, "CB_DAYNIGHT", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(GetIsNight() || GetIsDusk())
|
||||
{
|
||||
if(cbPCrace == RACIAL_TYPE_DWARF)
|
||||
{
|
||||
if((TestStringAgainstPattern("**GRAY**", cbPCsubrace)) ||
|
||||
(TestStringAgainstPattern("**DUERGAR**", cbPCsubrace)))
|
||||
{
|
||||
if(GetLocalInt(cbObject, "CB_DAYNIGHT") != 0)
|
||||
{
|
||||
attack(2, 3, cbObject);
|
||||
savingthrow(4, 2, 21, cbObject);
|
||||
skills(2, 21, cbObject);
|
||||
SetLocalInt(cbObject, "CB_DAYNIGHT", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cbPCrace == RACIAL_TYPE_ELF)
|
||||
{
|
||||
if((TestStringAgainstPattern("**DROW**", cbPCsubrace)) || (TestStringAgainstPattern("**DARK**", cbPCsubrace)))
|
||||
{
|
||||
if(GetLocalInt(cbObject, "CB_DAYNIGHT") != 0)
|
||||
{
|
||||
attack(1, 3, cbObject);
|
||||
savingthrow(4, 1, 21, cbObject);
|
||||
skills(1, 21, cbObject);
|
||||
SetLocalInt(cbObject, "CB_DAYNIGHT", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cbPCrace == RACIAL_TYPE_GNOME)
|
||||
{
|
||||
if((TestStringAgainstPattern("**DEEP**", cbPCsubrace)) || (TestStringAgainstPattern("**SVIRFNEBLIN**", cbPCsubrace)))
|
||||
{
|
||||
if(GetLocalInt(cbObject, "CB_DAYNIGHT") != 0)
|
||||
{
|
||||
skills(2, 6, cbObject);
|
||||
SetLocalInt(cbObject, "CB_DAYNIGHT", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cbObject = GetNextPC();
|
||||
cbPCrace = GetRacialType(cbObject);
|
||||
cbPCsubrace = GetStringUpperCase(GetSubRace(cbObject));
|
||||
}
|
||||
}
|
178
_module/nss/_cb_respawn_bio.nss
Normal file
178
_module/nss/_cb_respawn_bio.nss
Normal file
@@ -0,0 +1,178 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Generic On Pressed Respawn Button
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
// * June 1: moved RestoreEffects into plot include
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Brent
|
||||
//:: Created On: November
|
||||
//:://////////////////////////////////////////////
|
||||
#include "nw_i0_plot"
|
||||
#include "_cb_core"
|
||||
|
||||
// * Applies an XP and GP penalty
|
||||
// * to the player respawning
|
||||
void ApplyPenalty(object oDead)
|
||||
{
|
||||
int nXP = GetXP(oDead);
|
||||
int nPenalty = 0 * GetHitDice(oDead);
|
||||
int nHD = GetHitDice(oDead);
|
||||
// * You can not lose a level with this respawning
|
||||
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
|
||||
|
||||
int nNewXP = nXP - nPenalty;
|
||||
if (nNewXP < nMin)
|
||||
nNewXP = nMin;
|
||||
SetXP(oDead, nNewXP);
|
||||
int nGoldToTake = FloatToInt(0.0 * GetGold(oDead));
|
||||
// * a cap of 10 000gp taken from you
|
||||
if (nGoldToTake > 0)
|
||||
{
|
||||
nGoldToTake = 0;
|
||||
}
|
||||
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
|
||||
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
|
||||
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// this function resets variabls and clears the arenas in the fighter
|
||||
// 'gauntlet' subplot in chapter one
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ClearArena(object oPC,string sArena)
|
||||
{
|
||||
if(sArena == "Map_M1S4C")
|
||||
{
|
||||
DestroyObject(GetObjectByTag("M1S04CHRUSK02"));
|
||||
DestroyObject(GetObjectByTag("M1S4CBeast"));
|
||||
SetLocalInt(GetObjectByTag(sArena),"NW_A_M1S4HruskDef",0);
|
||||
}
|
||||
else if(sArena == "Map_M1S4D")
|
||||
{
|
||||
DestroyObject(GetObjectByTag("M1S04CFASHI02"));
|
||||
DestroyObject(GetObjectByTag("M1S4DBeast"));
|
||||
SetLocalInt(GetObjectByTag(sArena),"NW_A_M1S4FashiDef",0);
|
||||
CreateItemOnObject("M1S04IBADGELVL01",oPC);
|
||||
}
|
||||
else if(sArena == "Map_M1S4E")
|
||||
{
|
||||
DestroyObject(GetObjectByTag("M1S04CAGAR02"));
|
||||
DestroyObject(GetObjectByTag("M1S4EBeast"));
|
||||
SetLocalInt(GetObjectByTag(sArena),"NW_A_M1S4AgarDef",0);
|
||||
CreateItemOnObject("M1S04IBADGELVL02",oPC);
|
||||
}
|
||||
else if(sArena == "Map_M1S4F")
|
||||
{
|
||||
DestroyObject(GetObjectByTag("M1S04CCLAUDUS02"));
|
||||
DestroyObject(GetObjectByTag("M1S4FBeast",0));
|
||||
DestroyObject(GetObjectByTag("M1S4FBeast",1));
|
||||
SetLocalInt(GetObjectByTag(sArena),"NW_A_M1S4ClaudusDef",0);
|
||||
CreateItemOnObject("M1S04IBADGELVL03",oPC);
|
||||
}
|
||||
SetLocalInt(oPC,"NW_L_M1S4Won",FALSE);
|
||||
SetLocalInt(GetModule(),"NW_G_" + sArena + "_Occupied",FALSE);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oRespawner = GetLastRespawnButtonPresser();
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
||||
RemoveEffects(oRespawner);
|
||||
//* Return PC to temple
|
||||
|
||||
|
||||
|
||||
string sDestTag = "NW_DEATH_TEMPLE";
|
||||
string sArea = GetTag(GetArea(oRespawner));
|
||||
/*
|
||||
CHAPTER 1 SPECIAL CASE
|
||||
*/
|
||||
if (sArea == "MAP_M1S3B")
|
||||
{
|
||||
sDestTag = "M1_WIZSPAWN";
|
||||
}
|
||||
else
|
||||
if (sArea == "Map_M1S4E" || sArea == "Map_M1S4C" || sArea == "Map_M1S4D" || sArea == "Map_M1S4F")
|
||||
{
|
||||
sDestTag = "M1_FIGSPAWN";
|
||||
ClearArena(oRespawner,sArea);
|
||||
}
|
||||
else
|
||||
/*
|
||||
CHAPTER 2 SPECIAL CASE
|
||||
*/
|
||||
/*
|
||||
if (sArea == "MAP_M2Q2F2" && GetDistanceBetweenLocations(GetLocation(GetObjectByTag("M2Q2F2_M2Q2G")), GetLocation(oRespawner)) < 5.0 && GetLocalInt(GetModule(),"NW_M2Q2E_WoodsFreed") == 0)
|
||||
{
|
||||
|
||||
sDestTag = "WP_M2Q2GtoM2Q2F";
|
||||
}
|
||||
else
|
||||
*/
|
||||
// * Druid Match
|
||||
if (sArea == "MAP_M2Q2E2")
|
||||
{
|
||||
sDestTag = "WP_M2Q2E_ENDDCC";
|
||||
DestroyObject(GetObjectByTag("M2Q2EWELCARFT"));
|
||||
DestroyObject(GetObjectByTag("M2Q2EHENNAFT"));
|
||||
DestroyObject(GetObjectByTag("M2Q2EJANKENFT"));
|
||||
DestroyObject(GetObjectByTag("M2Q2EELGARFT"));
|
||||
// * June 2002: Destroy pets as well
|
||||
DestroyObject(GetObjectByTag("M2Q2EWELCARFTPET"));
|
||||
DestroyObject(GetObjectByTag("M2Q2EHENNAFTPET"));
|
||||
DestroyObject(GetObjectByTag("M2Q2EJANKENFTPET"));
|
||||
DestroyObject(GetObjectByTag("M2Q2EELGARFTPET"));
|
||||
|
||||
|
||||
SetLocalInt(GetObjectByTag("M2Q2EJAER"),"NW_M2Q2E_LFIGHT",FALSE);
|
||||
}
|
||||
/*
|
||||
CHAPTER 3 SPECIAL CASE
|
||||
*/
|
||||
else
|
||||
// * time travel dungeon past - Dungeon
|
||||
if (sArea == "M3Q2G")
|
||||
{
|
||||
sDestTag = "WP_ALTERNATE_SPWN";
|
||||
}
|
||||
// * time travel dungeon past - Grove
|
||||
else
|
||||
if (sArea == "M3Q2I")
|
||||
{
|
||||
sDestTag = "WP_ALTERNATE_SPWN";
|
||||
}
|
||||
if (GetIsObjectValid(GetObjectByTag(sDestTag)))
|
||||
{
|
||||
|
||||
if (sDestTag == "NW_DEATH_TEMPLE")
|
||||
{
|
||||
object oPriest = GetObjectByTag("NW_DEATH_CLERIC");
|
||||
//SetLocalInt(oPriest, "NW_L_SAYONELINER", 10);
|
||||
|
||||
//AssignCommand(oPriest, DelayCommand(3.0,ActionStartConversation(oRespawner)));
|
||||
AssignCommand(oPriest, DelayCommand(2.1, PlayVoiceChat(VOICE_CHAT_TALKTOME, oPriest)));
|
||||
|
||||
SetLocalLocation(oRespawner, "NW_L_I_DIED_HERE", GetLocation(GetLastRespawnButtonPresser()));
|
||||
SetLocalInt(oRespawner, "NW_L_I_DIED", 1);
|
||||
SetLocalObject(oPriest, "NW_L_LASTDIED", GetLastRespawnButtonPresser());
|
||||
// * April 2002: Moved penalty here, only when going back to the death temple
|
||||
ApplyPenalty(oRespawner);
|
||||
}
|
||||
object oSpawnPoint = GetObjectByTag(sDestTag);
|
||||
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
|
||||
// * mak
|
||||
}
|
||||
else
|
||||
{
|
||||
// * do nothing, just 'res where you are.
|
||||
}
|
||||
core(oRespawner);
|
||||
}
|
1067
_module/nss/_cb_stat.nss
Normal file
1067
_module/nss/_cb_stat.nss
Normal file
File diff suppressed because it is too large
Load Diff
709
_module/nss/_cb_subrace.nss
Normal file
709
_module/nss/_cb_subrace.nss
Normal file
@@ -0,0 +1,709 @@
|
||||
//ColdBlade
|
||||
//Subrace & Templates Function
|
||||
//Copyright (c) 2002 by Coldblade
|
||||
//V2.5.0
|
||||
//-------------------------------------------------
|
||||
//Jumped to version 2.5.0 because this would be a major core code rewrite.
|
||||
//I have decided to separe the orginal three function from the Version 1.0.0
|
||||
//into three separe files, one being the Raise/Lower Stats and Skills Include
|
||||
//file, the other one would be this file being the Subrace and Templates Include
|
||||
//Then the final one would be the Core which would worry about how to figure out
|
||||
//which subrace the player is. This one is just for seting up the stat bonus
|
||||
//and pentality plus other speical effects like the Drow's 11+Level Spell Resistance
|
||||
//All subrace and template return that template or subrace ECL as a Integer.
|
||||
//For certain speical effects that depends on day/night time cycle write it in
|
||||
//a function
|
||||
|
||||
//when altering my name for relase be sure to change and correct the #includes.
|
||||
#include "_cb_stat"
|
||||
|
||||
//--------------------------------------------
|
||||
//Miscellanous Function To Support Subraces
|
||||
//--------------------------------------------
|
||||
|
||||
int hitdicebonus(object cbObject)
|
||||
{
|
||||
int cbOld1 = GetLocalInt(cbObject, "CB_OLD1");
|
||||
int cbOld2 = GetLocalInt(cbObject, "CB_OLD2");
|
||||
int cbOld3 = GetLocalInt(cbObject, "CB_OLD3");
|
||||
int cbNew1 = d2(GetLevelByPosition(1, cbObject)); //:: I'm not going to encourage this stupidity.
|
||||
int cbNew2 = d2(GetLevelByPosition(2, cbObject));
|
||||
int cbNew3 = d2(GetLevelByPosition(3, cbObject));
|
||||
int cbClass1 = GetClassByPosition(1, cbObject);
|
||||
int cbClass2 = GetClassByPosition(2, cbObject);
|
||||
int cbClass3 = GetClassByPosition(3, cbObject);
|
||||
|
||||
//Due to the random nature of the randomizer and dice roll i'm going to setup
|
||||
//a while that won't quit untill the new hitdice bonus is higher than the old
|
||||
//by at minum 1 hp. Also check to make sure there's atleast one level in that
|
||||
//class slot, if its zero then don't do it cos well it would just get stuck
|
||||
//in a infine loop, not good!
|
||||
if (!GetIsDM(cbObject))
|
||||
{
|
||||
if(GetLevelByPosition(1, cbObject) != 0)
|
||||
{
|
||||
while(cbOld1 > cbNew1)
|
||||
{
|
||||
cbNew1 = d2(GetLevelByPosition(1, cbObject));
|
||||
}
|
||||
}
|
||||
if(GetLevelByPosition(2, cbObject) != 0)
|
||||
{
|
||||
while(cbOld2 > cbNew2)
|
||||
{
|
||||
cbNew2 = d2(GetLevelByPosition(2, cbObject));
|
||||
}
|
||||
}
|
||||
if(GetLevelByPosition(3, cbObject) != 0)
|
||||
{
|
||||
while(cbOld3 > cbNew3)
|
||||
{
|
||||
cbNew3 = d2(GetLevelByPosition(3, cbObject));
|
||||
}
|
||||
}
|
||||
//now if the class in any of the three avaiable slot is a barbarn then zero
|
||||
//that slot out so the barbarn won't get the hp bonus but all the other class will.
|
||||
if(cbClass1 == CLASS_TYPE_BARBARIAN) cbNew1 = 0;
|
||||
if(cbClass2 == CLASS_TYPE_BARBARIAN || CLASS_TYPE_INVALID) cbNew2 = 0;
|
||||
if(cbClass3 == CLASS_TYPE_BARBARIAN || CLASS_TYPE_INVALID) cbNew3 = 0;
|
||||
}
|
||||
//now to set the local int for the next levelup and also set the int for the bonus hp.
|
||||
SetLocalInt(cbObject, "CB_OLD1", cbNew1);
|
||||
SetLocalInt(cbObject, "CB_OLD2", cbNew2);
|
||||
SetLocalInt(cbObject, "CB_OLD3", cbNew3);
|
||||
return (cbNew1 + cbNew2 + cbNew3);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
//Subrace
|
||||
//------------------------------------
|
||||
|
||||
|
||||
//Gold Dwarves.
|
||||
//+2 Con, -2 Dex
|
||||
//+1 Racial Bonus on attack verus Aberrations. (replace attack bonus verus orc/goblinoids)
|
||||
int gold(object cbObject)
|
||||
{
|
||||
stat(6, 2, cbObject);
|
||||
stat(2, 2, cbObject, FALSE);
|
||||
//ditto how to replace the +1 racial bonus with the one verus aberration as stated in the description above.
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Gray(Duergar) Dwarves
|
||||
//+2 Con, -4 Cha
|
||||
//Immune to Paralysis, Phantasms, Magic or Alchemical Poisons (not normal Poison)
|
||||
//+4 racial bonus on move silently checks
|
||||
//+1 to listen and spot checks.
|
||||
//Light Sensitivity, upon dawn or daytime the Duergar Suffers a -2 Pentality on
|
||||
// Attack Rolls, Saves, and checks (aka Skills).
|
||||
//ECL +2
|
||||
int gray(object cbObject)
|
||||
{
|
||||
stat(2, 6, cbObject, FALSE);
|
||||
immunity(22, cbObject);
|
||||
spellimmunity(151, cbObject);
|
||||
spellimmunity(153, cbObject);
|
||||
skills(4, 9, cbObject);
|
||||
skills(1, 7, cbObject);
|
||||
skills(1, 18, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
CreateItemOnObject("duergarspelllike",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Duergar Spell-Like Ability, Do not lose it!");
|
||||
SetLocalInt(cbObject, "CB_ITEM", 1);
|
||||
}*/
|
||||
return 2;
|
||||
}
|
||||
|
||||
//Shield Dwarves
|
||||
//Standard Dwarves
|
||||
int shield(object cbObject)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//Drow
|
||||
//+2 Dex, -2 Con, +2 Int, +2 Cha
|
||||
//Darkvision (replaces Lowlight Vision)
|
||||
//Light Blindness, Drow is blinded onice a day for one round, -1 pentality to
|
||||
// attacks, saves, and skills.
|
||||
//spell resistance of 11+Level
|
||||
//+2 Racial Bonus to will saves verus spells.
|
||||
//ECL +2
|
||||
int drow(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
stat(2, 6, cbObject);
|
||||
stat(2, 4, cbObject);
|
||||
spellresistance(cbPClevel, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
CreateItemOnObject("drowspelllikeabi",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Drow Spell-Like Ability, Do not lose it!");
|
||||
SetLocalInt(cbObject, "CB_ITEM", 1);
|
||||
} */
|
||||
return 2;
|
||||
}
|
||||
|
||||
//Moon Elves
|
||||
//standard elves.
|
||||
int moon(object cbObject)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Sun Elves
|
||||
//+2 Int, -2 Con
|
||||
int sun(object cbObject)
|
||||
{
|
||||
stat(2, 4, cbObject);
|
||||
stat(2, 2, cbObject, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Wild Elves
|
||||
//+2 Dex, -2 Int
|
||||
int wild(object cbObject)
|
||||
{
|
||||
stat(2, 4, cbObject, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Wood Elves
|
||||
//+2 Str, +2 Dex, -2 Con, -2 Int, -2 Cha
|
||||
int wood(object cbObject)
|
||||
{
|
||||
stat(2, 1, cbObject);
|
||||
stat(2, 4, cbObject, FALSE);
|
||||
stat(2, 6, cbObject, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//Deep(Svirfneblin) Gnome
|
||||
//-2 Str, +2 Dex, +2 Wis, -4 Cha
|
||||
//Darkvision
|
||||
//Stonecunning
|
||||
//Spellresistance 11+Level
|
||||
//+4 dodge bonus verus all creatures.
|
||||
//+2 racial bonus on all saving throws
|
||||
//+2 racial bonus on hide check, which improves to +4 at night/dusk.
|
||||
//ECL +3
|
||||
int deep(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
spellresistance(cbPClevel, cbObject);
|
||||
stat(2, 2, cbObject);
|
||||
stat(2, 5, cbObject);
|
||||
stat(2, 3, cbObject, FALSE);
|
||||
stat(4, 6, cbObject, FALSE);
|
||||
savingthrow(4, 2, 21, cbObject);
|
||||
ac(4, 3, cbObject);
|
||||
skills(4, 6, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
CreateItemOnObject("svirfneblinspell",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Svirfneblin Spell-Like Ability, Do not lose it!");
|
||||
SetLocalInt(cbObject, "CB_ITEM", 1);
|
||||
} */
|
||||
return 3;
|
||||
}
|
||||
|
||||
//Rock Gnomes
|
||||
//Standard Gnomes
|
||||
int rock(object cbObject)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//Ghostwise Halfling
|
||||
//Speak without Sound
|
||||
//Does not recieve +1 saving bonus to saving throws.
|
||||
int ghostwise(object cbObject)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Lightfoot Halfling
|
||||
//standard halfling
|
||||
int lightfoot(object cbObject)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Strongheart Halfling
|
||||
//Recieve one extra feat at 1st level
|
||||
//does not recieve +1 saving bonus to saving throws.
|
||||
int strongheart(object cbObject)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
//Templates
|
||||
//------------------------------------------------
|
||||
|
||||
|
||||
//Aasimar
|
||||
//+2 Wis, +2 Cha
|
||||
//Acid, Cold, Electricity resistance 5/-
|
||||
//+2 racial bonus to listen and spot check
|
||||
//darkvision
|
||||
//outsider
|
||||
//ECL +1
|
||||
int aasimar(object cbObject)
|
||||
{
|
||||
stat(2, 5, cbObject);
|
||||
stat(2, 6, cbObject);
|
||||
damageresistance(1, 5, 0, cbObject);
|
||||
damageresistance(3, 5, 0, cbObject);
|
||||
damageresistance(5, 5, 0, cbObject);
|
||||
skills(2, 7, cbObject);
|
||||
skills(2, 18, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
CreateItemOnObject("aasimarspelllike",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Aasimar Spell-Like Ability, Do not lose it!");
|
||||
SetLocalInt(cbObject, "CB_ITEM", 1);
|
||||
}*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Tiefling
|
||||
//+2 Dex, +2 Int, -2 Cha
|
||||
//Fire, Cold, Electricity resistance 5/-
|
||||
//+2 racial bonus on bluff and hide check
|
||||
//outsider
|
||||
//darkvision
|
||||
//ECL +1
|
||||
int tiefling(object cbObject)
|
||||
{
|
||||
stat(2, 2, cbObject);
|
||||
stat(2, 4, cbObject);
|
||||
stat(2, 6, cbObject, FALSE);
|
||||
damageresistance(6, 5, 0, cbObject);
|
||||
damageresistance(3, 5, 0, cbObject);
|
||||
damageresistance(5, 5, 0, cbObject);
|
||||
skills(2, 6, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
CreateItemOnObject("tieflingspelllik",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Tiefling Spell-Like Ability, Do not lose it!");
|
||||
SetLocalInt(cbObject, "CB_ITEM", 1);
|
||||
} */
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Air Genasi
|
||||
//+2 Dex, +2 Int, -2 Wis, -2 Cha
|
||||
//darkvision
|
||||
//outsider
|
||||
//+1 saving throw to sonic effects, inreases every 5 level.
|
||||
//ECL +1
|
||||
int air(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
stat(2, 2, cbObject);
|
||||
stat(2, 4, cbObject);
|
||||
stat(2, 5, cbObject, FALSE);
|
||||
stat(2, 6, cbObject, FALSE);
|
||||
savingthrow(4, (1+(cbPClevel/5)), 18, cbObject, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Earth Genasi
|
||||
//+2 Str, +2 Con, -2 Wis, -2 Cha
|
||||
//darkvision
|
||||
//outsider
|
||||
//+1 saving throw to acid effect, increase every 5 level.
|
||||
//ECL +1
|
||||
int earth(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
stat(2, 1, cbObject);
|
||||
stat(2, 3, cbObject);
|
||||
stat(2, 5, cbObject, FALSE);
|
||||
stat(2, 6, cbObject, FALSE);
|
||||
savingthrow(4, (1+(cbPClevel/5)), 1, cbObject, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Fire Genasi
|
||||
//+2 Int, -2 Cha
|
||||
//darkvision
|
||||
//outsider
|
||||
//+1 saving throw to fire effect, increase every 5 level.
|
||||
//ECL +1
|
||||
int fire(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
stat(2, 4, cbObject);
|
||||
stat(2, 6, cbObject, FALSE);
|
||||
savingthrow(4, (1+(cbPClevel/5)), 11, cbObject, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Water Genasi
|
||||
//+2 Con, -2 Cha
|
||||
//darkvision
|
||||
//outsider
|
||||
//+1 saving throw to cold effect, increase every 5 level.
|
||||
//ECL +1
|
||||
int water(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
stat(2, 3, cbObject);
|
||||
stat(2, 6, cbObject, FALSE);
|
||||
savingthrow(4, (1+(cbPClevel/5)), 4, cbObject, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Celestial
|
||||
//Darkvision
|
||||
//Smite Evil
|
||||
//Acid, Cold, Electricity resistance
|
||||
//damage reduction
|
||||
//spell resistance equal to double player level, caps at 25
|
||||
//Level, A/C/E, DR, ECL
|
||||
//1-3, 5/-, -, -
|
||||
//4-7, 10/-, 5/+1, 1
|
||||
//8-11, 15/-, 5/+2, 2
|
||||
//12+, 20/-, 10/+3, 3
|
||||
int celestial(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
int cbSR = 2 * cbPClevel;
|
||||
if(cbSR == 25)
|
||||
{
|
||||
cbSR = 25;
|
||||
}
|
||||
spellresistance(cbSR, cbObject);
|
||||
if((cbPClevel >= 1) && (cbPClevel <= 3))
|
||||
{
|
||||
damageresistance(1, 5, 0, cbObject);
|
||||
damageresistance(3, 5, 0, cbObject);
|
||||
damageresistance(5, 5, 0, cbObject);
|
||||
return 0;
|
||||
}
|
||||
if((cbPClevel >= 4) && (cbPClevel <= 7))
|
||||
{
|
||||
damageresistance(1, 10, 0, cbObject);
|
||||
damageresistance(3, 10, 0, cbObject);
|
||||
damageresistance(5, 10, 0, cbObject);
|
||||
damagereduction(5, 3, 0, cbObject);
|
||||
return 1;
|
||||
}
|
||||
if((cbPClevel >= 8) && (cbPClevel <= 11))
|
||||
{
|
||||
damageresistance(1, 15, 0, cbObject);
|
||||
damageresistance(3, 15, 0, cbObject);
|
||||
damageresistance(5, 15, 0, cbObject);
|
||||
damagereduction(5, 4, 0, cbObject);
|
||||
return 2;
|
||||
}
|
||||
if(cbPClevel <= 12)
|
||||
{
|
||||
damageresistance(1, 20, 0, cbObject);
|
||||
damageresistance(3, 20, 0, cbObject);
|
||||
damageresistance(5, 20, 0, cbObject);
|
||||
damagereduction(10, 5, 0, cbObject);
|
||||
return 3;
|
||||
}
|
||||
return 0; //should never get here
|
||||
}
|
||||
|
||||
//Fiendish
|
||||
//Darkvision
|
||||
//Smite Good
|
||||
//Fire, Cold resistance
|
||||
//damage reduction
|
||||
//spell resistance equal to double player level, caps at 25
|
||||
//Level, F/C, DR, ECL
|
||||
//1-3, 5/-, -, -
|
||||
//4-7, 10/-, 5/+1, 1
|
||||
//8-11, 15/-, 5/+2, 2
|
||||
//12+, 20/-, 10/+3, 3
|
||||
int fiendish(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
int cbSR = 2 * cbPClevel;
|
||||
if(cbSR == 25)
|
||||
{
|
||||
cbSR = 25;
|
||||
}
|
||||
spellresistance(cbSR, cbObject);
|
||||
if((cbPClevel >= 1) && (cbPClevel <= 3))
|
||||
{
|
||||
damageresistance(6, 5, 0, cbObject);
|
||||
damageresistance(3, 5, 0, cbObject);
|
||||
return 0;
|
||||
}
|
||||
if((cbPClevel >= 4) && (cbPClevel <= 7))
|
||||
{
|
||||
damageresistance(6, 10, 0, cbObject);
|
||||
damageresistance(3, 10, 0, cbObject);
|
||||
damagereduction(5, 3, 0, cbObject);
|
||||
return 1;
|
||||
}
|
||||
if((cbPClevel >= 8) && (cbPClevel <= 11))
|
||||
{
|
||||
damageresistance(6, 15, 0, cbObject);
|
||||
damageresistance(3, 15, 0, cbObject);
|
||||
damagereduction(5, 4, 0, cbObject);
|
||||
return 2;
|
||||
}
|
||||
if(cbPClevel <= 12)
|
||||
{
|
||||
damageresistance(6, 20, 0, cbObject);
|
||||
damageresistance(3, 20, 0, cbObject);
|
||||
damagereduction(10, 5, 0, cbObject);
|
||||
return 3;
|
||||
}
|
||||
return 0; //should never get here
|
||||
}
|
||||
|
||||
//Half-Celestial
|
||||
//75% chance of doubling the character speed and get a wing attached.
|
||||
//Ac increase +1
|
||||
//+4 Str, +2 Dex, +4 Con, +2 Int, +4 Wis, +4 Cha
|
||||
//immune to acid, cold, disease, electricity
|
||||
//+4 racial bonus to fort save verus poison.
|
||||
//ECL +4
|
||||
int halfcelestial(object cbObject)
|
||||
{
|
||||
stat(4, 1, cbObject);
|
||||
stat(2, 2, cbObject);
|
||||
stat(4, 3, cbObject);
|
||||
stat(2, 4, cbObject);
|
||||
stat(4, 5, cbObject);
|
||||
stat(4, 6, cbObject);
|
||||
ac(1, 2, cbObject);
|
||||
savingthrow(1, 4, 16, cbObject);
|
||||
int cbDice = d4(1);
|
||||
if(cbDice = 1)
|
||||
{
|
||||
speed(200, cbObject);
|
||||
}
|
||||
damageimmunity(100, 1, cbObject, 1);
|
||||
damageimmunity(100, 3, cbObject, 1);
|
||||
damageimmunity(100, 5, cbObject, 1);
|
||||
immunity(14, cbObject);
|
||||
return 4;
|
||||
}
|
||||
|
||||
//Half-Fiend
|
||||
//Ac increase +1
|
||||
//50% to multiple speed by 1.5 and get a wing attached
|
||||
//darkvision
|
||||
//+4 Str, +4 Dex, +2 Con, +4 Int, +0 Wis, +2 Cha
|
||||
//immune to poison.
|
||||
//acid cold electricity and fire resistance of 20/-
|
||||
//ECL +4
|
||||
int halffiend(object cbObject)
|
||||
{
|
||||
stat(4, 1, cbObject);
|
||||
stat(4, 2, cbObject);
|
||||
stat(4, 3, cbObject);
|
||||
stat(4, 4, cbObject);
|
||||
stat(4, 6, cbObject);
|
||||
ac(1, 2, cbObject);
|
||||
immunity(23, cbObject);
|
||||
damageresistance(1, 20, 0, cbObject);
|
||||
damageresistance(3, 20, 0, cbObject);
|
||||
damageresistance(6, 20, 0, cbObject);
|
||||
damageresistance(5, 20, 0, cbObject);
|
||||
int cbDice = d4(1);
|
||||
if(cbDice >= 2)
|
||||
{
|
||||
speed(150, cbObject);
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
//Half-Dragon
|
||||
//Hitdice Imcreases one dice type, to a max of 1d12
|
||||
//Ac increase +4 Natural
|
||||
//Type of dragon you are Depends on your aligment.
|
||||
//+8 Str, +0 Dex, +2 Con, +2 Int, +0 Wis, +2 Cha
|
||||
//Darkvision
|
||||
//Immune sleep, paralysis.
|
||||
|
||||
//It checks your alignment so on then randomly select the dragon in that catalogry
|
||||
//Chaotic Evil: Black, Red, White
|
||||
//Lawful Evil: Blue, Green
|
||||
//Chaotic Good: Brass, Copper
|
||||
//Lawful Good: Bronze, Gold, Silver
|
||||
|
||||
//Then the immunity is set depending on your dragon type.
|
||||
//Acid: Black, Green, Copper
|
||||
//Cold: White, Silver
|
||||
//Fire: Red, Brass, Gold
|
||||
//Electricity: Blue, Bronze
|
||||
|
||||
//Then depending on your type of dragon it choice your dragon breath (cone only)
|
||||
//Fire: Red, Brass, Gold
|
||||
//Acid: Black, Copper
|
||||
//Cold: White, Silver
|
||||
//Electricity: Blue, Bronze
|
||||
//Gas: Green
|
||||
//ECL +5
|
||||
int halfdragon(object cbObject)
|
||||
{
|
||||
int cbPClevel = GetLevelByPosition(1, cbObject) + GetLevelByPosition(2, cbObject) + GetLevelByPosition(3, cbObject);
|
||||
int cbGoodEvil = GetAlignmentGoodEvil(cbObject);
|
||||
int cbLawChaos = GetAlignmentLawChaos(cbObject);
|
||||
int cbType1 = d2(1);
|
||||
int cbType2 = d3(1);
|
||||
ac(4, 4, cbObject);
|
||||
stat(8, 1, cbObject);
|
||||
stat(2, 3, cbObject);
|
||||
stat(2, 4, cbObject);
|
||||
stat(2, 6, cbObject);
|
||||
immunity(27, cbObject);
|
||||
immunity(22, cbObject);
|
||||
//To simplefye the code a bit i set so that the hitdice bonus of the half-dragon update
|
||||
//when the player reenter or dies and get resurrected.
|
||||
hitpoint(hitdicebonus(cbObject), cbObject);
|
||||
//Here we check your alignment and setup which dragon u get :)
|
||||
//it checks only onice per game so if ur aligment shift u won't suddenly
|
||||
//get a gold or say a red dragon for example it gives u one dragon type
|
||||
//then it sticks with it for the rest of the game.
|
||||
if(GetLocalInt(cbObject, "CB_CHECK") == 0)
|
||||
{
|
||||
if(cbGoodEvil == ALIGNMENT_EVIL && cbLawChaos == ALIGNMENT_LAWFUL)
|
||||
{
|
||||
switch(cbType1)
|
||||
{
|
||||
case 1: SetLocalInt(cbObject, "CB_DRAGON", 1); break; //Blue Half-Dragon
|
||||
default: SetLocalInt(cbObject, "CB_DRAGON", 2); break; //Green Half-Dragon
|
||||
}
|
||||
}
|
||||
if(cbGoodEvil == ALIGNMENT_EVIL && cbLawChaos == ALIGNMENT_CHAOTIC)
|
||||
{
|
||||
switch(cbType2)
|
||||
{
|
||||
case 1: SetLocalInt(cbObject, "CB_DRAGON", 3); break; //Black Half-Dragon
|
||||
case 2: SetLocalInt(cbObject, "CB_DRAGON", 4); break; //Red Half-Dragon
|
||||
default: SetLocalInt(cbObject, "CB_DRAGON", 5); break; //White Half-Dragon
|
||||
}
|
||||
}
|
||||
if(cbGoodEvil == ALIGNMENT_GOOD && cbLawChaos == ALIGNMENT_LAWFUL)
|
||||
{
|
||||
switch(cbType1)
|
||||
{
|
||||
case 1: SetLocalInt(cbObject, "CB_DRAGON", 6); break; //Gold Half-Dragon
|
||||
case 2: SetLocalInt(cbObject, "CB_DRAGON", 7); break; //Silver Half-Dragon
|
||||
default: SetLocalInt(cbObject, "CB_DRAGON", 8); break; //Bronze Half-Dragon
|
||||
}
|
||||
}
|
||||
if(cbGoodEvil == ALIGNMENT_GOOD && cbLawChaos == ALIGNMENT_CHAOTIC)
|
||||
{
|
||||
switch(cbType2)
|
||||
{
|
||||
case 1: SetLocalInt(cbObject, "CB_DRAGON", 9); break; //Brass Half-Dragon
|
||||
default: SetLocalInt(cbObject, "CB_DRAGON", 10); break; //Copper Half-Dragon
|
||||
}
|
||||
}
|
||||
SetLocalInt(cbObject, "CB_CHECK", 1);
|
||||
}
|
||||
switch(GetLocalInt(cbObject, "CB_DRAGON"))
|
||||
{
|
||||
case 1: //Blue Half-Dragon
|
||||
damageimmunity(100, 5, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Blue Half-Dragon!");
|
||||
CreateItemOnObject("bluehalfdragonbr",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Blue Half-Dragon Breathe Ability, Do not lose it!");
|
||||
}*/
|
||||
break;
|
||||
case 2: //Green Half-Dragon
|
||||
damageimmunity(100, 1, cbObject);
|
||||
/* if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Green Half-Dragon!");
|
||||
CreateItemOnObject("Greenhalfdragonb",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Green Half-Dragon Breathe Ability, Do not lose it!");
|
||||
}*/
|
||||
break;
|
||||
case 3: //Black Half-Dragon
|
||||
damageimmunity(100, 1, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Black Half-Dragon!");
|
||||
CreateItemOnObject("blackhalfdragonb",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Black Half-Dragon Breathe Ability, Do not lose it!");
|
||||
} */
|
||||
break;
|
||||
case 4: //Red Half-Dragon
|
||||
damageimmunity(100, 6, cbObject);
|
||||
/* if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Red Half-Dragon!");
|
||||
CreateItemOnObject("Redhalfdragonbre",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Red Half-Dragon Breathe Ability, Do not lose it!");
|
||||
}*/
|
||||
break;
|
||||
case 5: //White Half-Dragon
|
||||
damageimmunity(100, 3, cbObject);
|
||||
/* if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a White Half-Dragon!");
|
||||
CreateItemOnObject("whitehalfdragonb",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the White Half-Dragon Breathe Ability, Do not lose it!");
|
||||
} */
|
||||
break;
|
||||
case 6: //Gold Half-Dragon
|
||||
damageimmunity(100, 6, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Gold Half-Dragon!");
|
||||
CreateItemOnObject("goldhalfdragonbr",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Gold Half-Dragon Breathe Ability, Do not lose it!");
|
||||
} */
|
||||
break;
|
||||
case 7: //Silver Half-Dragon
|
||||
damageimmunity(100, 3, cbObject);
|
||||
/* if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Silver Half-Dragon!");
|
||||
CreateItemOnObject("silverhalfdragon",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Silver Half-Dragon Breathe Ability, Do not lose it!");
|
||||
} */
|
||||
break;
|
||||
case 8: //Bronze Half-Dragon
|
||||
damageimmunity(100, 5, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Bronze Half-Dragon!");
|
||||
CreateItemOnObject("bronzehalfdragon",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Bronze Half-Dragon Breathe Ability, Do not lose it!");
|
||||
} */
|
||||
break;
|
||||
case 9: //Brass Half-Dragon
|
||||
damageimmunity(100, 6, cbObject);
|
||||
/*if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Brass Half-Dragon!");
|
||||
CreateItemOnObject("brasshalfdragonb",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Brass Half-Dragon Breathe Ability, Do not lose it!");
|
||||
} */
|
||||
break;
|
||||
default: //Copper Half-Dragon
|
||||
damageimmunity(100, 1, cbObject);
|
||||
/* if(GetLocalInt(cbObject, "CB_ITEM") != 1)
|
||||
{
|
||||
SendMessageToPC(cbObject,"You are a Copper Half-Dragon!");
|
||||
CreateItemOnObject("copperhalfdragon",cbObject);
|
||||
SendMessageToPC(cbObject,"You have the object for the Copper Half-Dragon Breathe Ability, Do not lose it!");
|
||||
} */
|
||||
break;
|
||||
}
|
||||
return 5;
|
||||
}
|
||||
|
1
_module/nss/_cb_userdef.nss
Normal file
1
_module/nss/_cb_userdef.nss
Normal file
@@ -0,0 +1 @@
|
||||
|
65
_module/nss/_chest_respawn.nss
Normal file
65
_module/nss/_chest_respawn.nss
Normal file
@@ -0,0 +1,65 @@
|
||||
void main()
|
||||
{
|
||||
string sSelf = GetResRef(OBJECT_SELF);
|
||||
location lSelf = GetLocation(OBJECT_SELF);
|
||||
string sLootBag;
|
||||
int iSearchForBag = 0;
|
||||
object oSearchForBag;
|
||||
object oBagItem;
|
||||
|
||||
if (sSelf == "temporaryplaceho")
|
||||
{
|
||||
sSelf = GetLocalString(OBJECT_SELF,"sType");
|
||||
//SendMessageToPC(GetFirstPC(),"Destroying Dropped Lootbag");
|
||||
|
||||
|
||||
while (sLootBag != "Body Bag")
|
||||
{
|
||||
|
||||
oSearchForBag = GetNearestObject(OBJECT_TYPE_ALL,OBJECT_SELF,iSearchForBag);
|
||||
if (oSearchForBag== OBJECT_INVALID)
|
||||
{
|
||||
//SendMessageToPC(GetFirstPC(),"Bag Not Found");
|
||||
break;
|
||||
}
|
||||
|
||||
sLootBag = GetTag(oSearchForBag);
|
||||
|
||||
iSearchForBag++;
|
||||
}
|
||||
|
||||
if (sLootBag == "Body Bag")
|
||||
{
|
||||
//SendMessageToPC(GetFirstPC(),"Distance: "+FloatToString(GetDistanceToObject(oSearchForBag)));
|
||||
if (GetDistanceToObject(oSearchForBag)<= 0.5)
|
||||
{
|
||||
oBagItem = GetFirstItemInInventory(oSearchForBag);
|
||||
while (oBagItem != OBJECT_INVALID)
|
||||
{
|
||||
DestroyObject(oBagItem,1.0);
|
||||
oBagItem = GetNextItemInInventory(oSearchForBag);
|
||||
}
|
||||
DestroyObject(oSearchForBag,1.0);
|
||||
}
|
||||
}
|
||||
|
||||
//SendMessageToPC(GetFirstPC(),"lootbag = " +sLootBag);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
oBagItem = GetFirstItemInInventory(OBJECT_SELF);
|
||||
|
||||
while (oBagItem != OBJECT_INVALID)
|
||||
{
|
||||
DestroyObject(oBagItem,1.0);
|
||||
oBagItem = GetNextItemInInventory(OBJECT_SELF);
|
||||
}
|
||||
|
||||
//SendMessageToPC(GetFirstPC(),"Destroying Chest");
|
||||
}
|
||||
DestroyObject(OBJECT_SELF,5.0);
|
||||
//SendMessageToPC(GetFirstPC(),"Replacing Chest");
|
||||
CreateObject(OBJECT_TYPE_PLACEABLE,sSelf,lSelf,FALSE);
|
||||
|
||||
}
|
52
_module/nss/_cleanstore.nss
Normal file
52
_module/nss/_cleanstore.nss
Normal file
@@ -0,0 +1,52 @@
|
||||
///////////////////////////////////////////////////////
|
||||
// clean_store2
|
||||
// Merchant inventory cleanup script 2.0
|
||||
// goes in merchant object onOpenStore script handler
|
||||
//
|
||||
// written September 30, 2003 by NWC Snake
|
||||
// copyright 2003 by Neverwinter Consortium
|
||||
// Permission to use this script is granted as long
|
||||
// as no changes are made to any portion of the script
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// This script will eliminate items tagged with the
|
||||
// local integer PCItem
|
||||
//
|
||||
// Requires onItemAcquired script that sets PCItem
|
||||
// to 1 when a PC picks up an item
|
||||
//
|
||||
// This version does not allow PC items to persist
|
||||
// in the merchant inventory. PC items are destroyed
|
||||
// when the store is first opened
|
||||
//
|
||||
// If the store is opened by a conversation, make sure
|
||||
// you set it to No Interruption to avoid problems
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void main()
|
||||
{ // start main
|
||||
|
||||
// create object variable for store object (self)
|
||||
object oStore = OBJECT_SELF;
|
||||
|
||||
// Get first item in store inventory
|
||||
object oItem = GetFirstItemInInventory(oStore);
|
||||
|
||||
// start while loop, checking for valid inventory items
|
||||
while(GetIsObjectValid(oItem))
|
||||
{
|
||||
// read item's PCItem flag
|
||||
int nItemFlag = GetLocalInt(oItem, "PCItem");
|
||||
|
||||
// if PCItem flag is non-zero, destroy the item
|
||||
if(nItemFlag != 0)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
// get next item in store inventory
|
||||
oItem = GetNextItemInInventory(oStore);
|
||||
} // end while
|
||||
} // end main
|
4
_module/nss/_closedoor.nss
Normal file
4
_module/nss/_closedoor.nss
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
DelayCommand(30.0, ActionCloseDoor(OBJECT_SELF));
|
||||
}
|
8
_module/nss/_closelockdoor.nss
Normal file
8
_module/nss/_closelockdoor.nss
Normal file
@@ -0,0 +1,8 @@
|
||||
void main()
|
||||
{
|
||||
|
||||
object oDoor = OBJECT_SELF;
|
||||
object oUser = GetLastOpenedBy();
|
||||
AssignCommand(oDoor,DelayCommand(15.0, ActionCloseDoor(oDoor)));
|
||||
AssignCommand(oDoor,DelayCommand(15.0, SetLocked(oDoor,TRUE)));
|
||||
}
|
8
_module/nss/_closelockdoor1.nss
Normal file
8
_module/nss/_closelockdoor1.nss
Normal file
@@ -0,0 +1,8 @@
|
||||
void main()
|
||||
{
|
||||
|
||||
object oDoor = OBJECT_SELF;
|
||||
object oUser = GetLastOpenedBy();
|
||||
AssignCommand(oDoor,DelayCommand(10.0, ActionCloseDoor(oDoor)));
|
||||
AssignCommand(oDoor,DelayCommand(10.0, SetLocked(oDoor,TRUE)));
|
||||
}
|
4
_module/nss/_contwalk.nss
Normal file
4
_module/nss/_contwalk.nss
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
ActionDoCommand(ExecuteScript("nw_d2_walkways",OBJECT_SELF));
|
||||
}
|
1592
_module/nss/_craft_alchemist.nss
Normal file
1592
_module/nss/_craft_alchemist.nss
Normal file
File diff suppressed because it is too large
Load Diff
3860
_module/nss/_craft_anvil.nss
Normal file
3860
_module/nss/_craft_anvil.nss
Normal file
File diff suppressed because it is too large
Load Diff
235
_module/nss/_craft_beehive.nss
Normal file
235
_module/nss/_craft_beehive.nss
Normal file
@@ -0,0 +1,235 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void BeeAttackPC(object oPC, object oSelf);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
object oPC = GetLastDisturbed();
|
||||
object oSelf = OBJECT_SELF;
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetInventoryDisturbType()== INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(GetInventoryDisturbItem());
|
||||
return;
|
||||
}
|
||||
if (GetTag(oItem) == "ITEM_BEESWAX")
|
||||
{
|
||||
FloatingTextStringOnCreature("You gather some beeswax from the hive.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
int iAmInUse = GetLocalInt(oSelf,"iAmInUse");
|
||||
if (iAmInUse != 0)
|
||||
{
|
||||
FloatingTextStringOnCreature("Other than collecting beeswax, you can only do one thing at a time!",oPC,FALSE);
|
||||
CopyObject(oItem,GetLocation(oSelf),oSelf,GetTag(oItem));
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
SetLocalInt(oSelf,"iAmInUse",99);
|
||||
DelayCommand(7.0,SetLocalInt(oSelf,"iAmInUse",0));
|
||||
//ensure at least 1 respawn 10 minutes after used...
|
||||
//this is to prevent a broken placeable that is used, with a 'in use' delay
|
||||
//which would cancel the respawn
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmSetToRespawn")!=99)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"iAmSetToRespawn",99);
|
||||
DelayCommand(600.0,ExecuteScript("_onclose_clear2",OBJECT_SELF));
|
||||
}
|
||||
|
||||
int iDay = GetLocalInt(oSelf,"iLastDay");
|
||||
int iHour = GetLocalInt(oSelf,"iLastHour");
|
||||
int iHoneyComb = GetLocalInt(oSelf,"iHoneyComb");
|
||||
int iHoney = GetLocalInt(oSelf,"iHoney");
|
||||
|
||||
//int iBeeSkill = GetTokenPair(oPC,13,1);
|
||||
|
||||
//uses NWN database
|
||||
//int iBeeSkill = GetCampaignInt("UOACraft","iBeeSkill",oPC);
|
||||
|
||||
//uses external database
|
||||
int iBeeSkill = GetPersistentInt(oPC,"iBeeSkill","UOACraft");
|
||||
|
||||
int iBeeChance = iBeeSkill;
|
||||
|
||||
if (iBeeChance <350)
|
||||
{
|
||||
iBeeChance = GetAbilityScore(oPC,ABILITY_WISDOM)*5;
|
||||
iBeeChance = iBeeChance +(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
|
||||
iBeeChance = iBeeChance +(GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
|
||||
iBeeChance = iBeeChance * 3;
|
||||
if (iBeeChance >350) iBeeChance = 350;
|
||||
if (iBeeSkill > iBeeChance) iBeeChance = iBeeSkill;
|
||||
}
|
||||
|
||||
int iRandom = Random(1000);
|
||||
int iSuccess=0;
|
||||
|
||||
string sSuccess = "";
|
||||
string sFail = "";
|
||||
string sItem = "";
|
||||
|
||||
AssignCommand(oPC,DelayCommand(1.0,PlaySound("as_na_grassmove1")));
|
||||
AssignCommand(oPC,DelayCommand(4.0,PlaySound("as_na_grassmove2")));
|
||||
|
||||
if (GetTag(oItem)=="ITEM_HONEYCOMB")
|
||||
{
|
||||
FloatingTextStringOnCreature("You begin to cut the honeycomb from the beehive.",oPC,FALSE);
|
||||
sItem = "honeycomb";
|
||||
iBeeChance = iBeeChance - 250;
|
||||
sSuccess = "You carefully cut the honeycomb from the hive.";
|
||||
if (iRandom <= iBeeChance) iSuccess=1;
|
||||
iHoneyComb--;
|
||||
if (iSuccess != 1)
|
||||
{
|
||||
if (Random(1000)>iBeeChance)
|
||||
{
|
||||
sFail = "You have disturbed the hive while trying to remove the honeycomb!";
|
||||
AssignCommand(oPC,DelayCommand(6.0,BeeAttackPC(oPC,oSelf)));
|
||||
}
|
||||
else
|
||||
{
|
||||
sFail = "You have destroyed the honeycomb while trying to remove it from the hive!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GetTag(oItem)=="ITEM_HONEY")
|
||||
{
|
||||
FloatingTextStringOnCreature("You begin gathering up some of the honey from the beehive.",oPC,FALSE);
|
||||
sItem = "honey";
|
||||
iHoney--;
|
||||
sSuccess = "You carefully collect the honey from the hive.";
|
||||
if (iRandom <= iBeeChance) iSuccess=1;
|
||||
|
||||
if (iSuccess != 1)
|
||||
{
|
||||
if (Random(1000)>iBeeChance)
|
||||
{
|
||||
sFail = "You have disturbed the hive while trying to collect the honey!";
|
||||
AssignCommand(oPC,DelayCommand(6.0,BeeAttackPC(oPC,oSelf)));
|
||||
}
|
||||
else
|
||||
{
|
||||
sFail = "You have contaminated the honey while trying to remove it from the hive.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,6.0));
|
||||
//AssignCommand(oPC,PlaySound(""));
|
||||
|
||||
SetLocalInt(oSelf,"iHoneyComb",iHoneyComb);
|
||||
SetLocalInt(oSelf,"iHoney",iHoney);
|
||||
|
||||
DestroyObject(oItem);
|
||||
|
||||
int iSkillGain =0;
|
||||
|
||||
if (iSuccess==1)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(6.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
AssignCommand(oPC,DelayCommand(6.0,CreateAnObject(sItem,oPC,1)));
|
||||
iRandom = Random(1000);
|
||||
if (iRandom >= iBeeSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iBeeChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(6.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iBeeSkill++;
|
||||
sOldSkill2 = IntToString(iBeeSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iBeeSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iBeeSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(6.0,SetTokenPair(oPC,13,1,iBeeSkill));
|
||||
|
||||
//uses NWN database
|
||||
//DelayCommand(6.0,SetCampaignInt("UOACraft","iBeeSkill",iBeeSkill,oPC));
|
||||
|
||||
//uses external database
|
||||
DelayCommand(6.0,SetPersistentInt(oPC,"iBeeSkill",iBeeSkill,0,"UOACraft"));
|
||||
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"====================================="));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Your skill in beekeeping has gone up!"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Current beekeeping skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"====================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(5.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void BeeAttackPC(object oPC, object oSelf)
|
||||
{
|
||||
AssignCommand(oPC,PlaySound("al_an_flies1"));
|
||||
AssignCommand(oPC,ActionMoveAwayFromObject(oSelf,TRUE,20.0));
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d4(1),DAMAGE_TYPE_PIERCING,DAMAGE_POWER_NORMAL),oPC,1.0);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_ELECTRICAL,FALSE),oPC,1.0);
|
||||
PlayVoiceChat(VOICE_CHAT_PAIN1,oPC);
|
||||
if (FortitudeSave(oPC,12,SAVING_THROW_TYPE_POISON,oSelf)==0)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(3.0,FloatingTextStringOnCreature("You have had an allergic reaction to the stings!",oPC,FALSE)));
|
||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectAbilityDecrease(ABILITY_DEXTERITY,d4(1)),oPC,18000.0);
|
||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectAbilityDecrease(ABILITY_CONSTITUTION,d4(1)),oPC,18000.0);
|
||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectAbilityDecrease(ABILITY_STRENGTH,d4(1)),oPC,18000.0);
|
||||
AssignCommand(oPC,DelayCommand(3.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_HEAD_ODD,FALSE),oPC,1.0)));
|
||||
AssignCommand(oPC,DelayCommand(3.0,PlayVoiceChat(VOICE_CHAT_PAIN2,oPC)));
|
||||
}
|
||||
}
|
867
_module/nss/_craft_bowyer.nss
Normal file
867
_module/nss/_craft_bowyer.nss
Normal file
@@ -0,0 +1,867 @@
|
||||
//#include "_persist_01a"
|
||||
#include "nw_i0_plot"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef);
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag);
|
||||
string GetComponent(int iWoodType);
|
||||
string GetComponentName(int iWoodType);
|
||||
string CraftLookup(string sResRef, int iWoodType);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oSelf = OBJECT_SELF;
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
object oPC = GetLastDisturbed();
|
||||
string sTag = GetTag(oItem);
|
||||
string sSuccess = "";
|
||||
string sFail = "";
|
||||
string sItemResRef = "";
|
||||
string sItemResRefPoor = "";
|
||||
string sItemResRefExceptional = "";
|
||||
int iRandom = 0;
|
||||
int iSuccess = 0;
|
||||
int iSkillGain = 0;
|
||||
int iComponent1 = 1;
|
||||
int iComponent2 = 0;
|
||||
int iComponent3 = 0;
|
||||
int iComponent1Stackable = 1;
|
||||
int iComponent2Stackable = 0;
|
||||
int iComponent3Stackable = 0;
|
||||
int iStackSize = 0;
|
||||
int iWoodType = GetLocalInt(oPC,"iUseThisWood"); // Credit to Lau3 for reporting this spacing error "iUseThis Wood".
|
||||
int iPenalty = iWoodType*5;
|
||||
int iDifficulty = 0;
|
||||
string sComponent1 = "";
|
||||
string sComponent2 = "";
|
||||
string sComponent3 = "";
|
||||
string sComponent1Name = "";
|
||||
string sComponent2Name = "";
|
||||
string sComponent3Name = "";
|
||||
string sComponentResRef = "";
|
||||
object oTemp = OBJECT_INVALID;
|
||||
|
||||
|
||||
if (GetInventoryDisturbType()== INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You can only craft by removing pattern tokens from this station.",oPC,FALSE);
|
||||
}
|
||||
|
||||
if (GetStringLeft(GetResRef(oItem),10)=="flagswitch")
|
||||
{
|
||||
if (sTag == "SWITCH_WOOD1") SetLocalInt(oPC,"iUseThisWood",0);
|
||||
if (sTag == "SWITCH_WOOD2") SetLocalInt(oPC,"iUseThisWood",1);
|
||||
if (sTag == "SWITCH_WOOD3") SetLocalInt(oPC,"iUseThisWood",2);
|
||||
if (sTag == "SWITCH_WOOD4") SetLocalInt(oPC,"iUseThisWood",3);
|
||||
if (sTag == "SWITCH_WOOD5") SetLocalInt(oPC,"iUseThisWood",4);
|
||||
if (sTag == "SWITCH_WOOD6") SetLocalInt(oPC,"iUseThisWood",5);
|
||||
if (sTag == "SWITCH_WOOD7") SetLocalInt(oPC,"iUseThisWood",6);
|
||||
if (sTag == "SWITCH_WOOD8") SetLocalInt(oPC,"iUseThisWood",7);
|
||||
if (sTag == "SWITCH_WOOD9") SetLocalInt(oPC,"iUseThisWood",8);
|
||||
if (sTag == "SWITCH_WOOD10") SetLocalInt(oPC,"iUseThisWood",9);
|
||||
if (sTag == "SWITCH_WOOD11") SetLocalInt(oPC,"iUseThisWood",10);
|
||||
if (sTag == "SWITCH_WOOD12") SetLocalInt(oPC,"iUseThisWood",11);
|
||||
if (sTag == "SWITCH_WOOD13") SetLocalInt(oPC,"iUseThisWood",12);
|
||||
if (sTag == "SWITCH_WOOD14") SetLocalInt(oPC,"iUseThisWood",13);
|
||||
if (sTag == "SWITCH_WOOD15") SetLocalInt(oPC,"iUseThisWood",14);
|
||||
if (sTag == "SWITCH_WOOD16") SetLocalInt(oPC,"iUseThisWood",15);
|
||||
if (sTag == "SWITCH_WOOD17") SetLocalInt(oPC,"iUseThisWood",16);
|
||||
if (sTag == "SWITCH_WOOD18") SetLocalInt(oPC,"iUseThisWood",17);
|
||||
if (sTag == "SWITCH_WOOD19") SetLocalInt(oPC,"iUseThisWood",18);
|
||||
string sWoodMessage = "Switching wood types. now set to "+GetStringLowerCase(GetName(oItem))+".";
|
||||
FloatingTextStringOnCreature(sWoodMessage,oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
string sTagSelf = GetTag(oSelf);
|
||||
AssignCommand(oPC,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE));
|
||||
AssignCommand(oPC,DelayCommand(1.5,DoPlaceableObjectAction(GetNearestObjectByTag(sTagSelf,oPC,1),PLACEABLE_ACTION_USE)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetStringLeft(GetResRef(oItem),7)!="pattern") return;
|
||||
CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem));
|
||||
DestroyObject(oItem);
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You must wait till the current bow or crossbow is completed before starting another.");
|
||||
return;
|
||||
}
|
||||
|
||||
//int iBowSkill = GetTokenPair(oPC,13,3);
|
||||
|
||||
// uses NWN database
|
||||
//int iBowSkill = GetCampaignInt("UOACraft","iBowSkill",oPC);
|
||||
|
||||
//external database
|
||||
int iBowSkill = GetPersistentInt(oPC,"iBowSkill","UOACraft");
|
||||
|
||||
int iBowChance = iBowSkill;
|
||||
if (iBowChance < 350)
|
||||
{
|
||||
iBowChance = GetAbilityScore(oPC,ABILITY_STRENGTH)*5;
|
||||
iBowChance = iBowChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
|
||||
iBowChance = iBowChance+(GetAbilityScore(oPC,ABILITY_WISDOM)*2);
|
||||
iBowChance = iBowChance*3;
|
||||
if (iBowChance>350)iBowChance=350;
|
||||
if (iBowSkill > iBowChance) iBowChance=iBowSkill;
|
||||
}
|
||||
|
||||
// Adjust skill for the penalty for the wood type being used.
|
||||
iBowChance = iBowChance - iPenalty;
|
||||
|
||||
// begin crafting test
|
||||
if (sTag == "P_SHORTBOW")
|
||||
{
|
||||
sSuccess = "You successfully form and shape the wood into a shortbow.";
|
||||
sFail = "You are unable to shape and form the wood properly, and the shortbow is ruined.";
|
||||
sItemResRefPoor = CraftLookup("wbwsh002",iWoodType);
|
||||
sItemResRef = CraftLookup("nw_wbwsh001",iWoodType);
|
||||
sItemResRefExceptional = CraftLookup("wbwsh003",iWoodType);
|
||||
sComponent1 = GetComponent(iWoodType);
|
||||
iComponent1 = 3;
|
||||
}
|
||||
|
||||
if (sTag == "P_LONGBOW")
|
||||
{
|
||||
iDifficulty = 400;
|
||||
sSuccess = "You successfully form and shape the wood into a longbow.";
|
||||
sFail = "You are unable to shape and form the wood properly, and the longbow is ruined.";
|
||||
sItemResRefPoor = CraftLookup("wbwln002",iWoodType);
|
||||
sItemResRef = CraftLookup("nw_wbwln001",iWoodType);
|
||||
sItemResRefExceptional = CraftLookup("wbwln003",iWoodType);
|
||||
sComponent1 = GetComponent(iWoodType);
|
||||
iComponent1 = 6;
|
||||
}
|
||||
|
||||
if (sTag == "P_LIGHTCROSSBOW")
|
||||
{
|
||||
iDifficulty = 250;
|
||||
sSuccess = "You successfully form and shape the wood into a light crossbow.";
|
||||
sFail = "You are unable to shape and form the wood properly, and the light crossbow is ruined.";
|
||||
sItemResRefPoor = CraftLookup("wbwxl002",iWoodType);
|
||||
sItemResRef = CraftLookup("nw_wbwxl001",iWoodType);
|
||||
sItemResRefExceptional = CraftLookup("wbwxl003",iWoodType);
|
||||
sComponent1 = GetComponent(iWoodType);
|
||||
iComponent1 = 4;
|
||||
}
|
||||
|
||||
if (sTag == "P_HEAVYCROSSBOW")
|
||||
{
|
||||
iDifficulty = 450;
|
||||
sSuccess = "You successfully form and shape the wood into a heavy crossbow.";
|
||||
sFail = "You are unable to shape and form the wood properly, and the heavy crossbow is ruined.";
|
||||
sItemResRefPoor = CraftLookup("wbwxh002",iWoodType);
|
||||
sItemResRef = CraftLookup("nw_wbwxh001",iWoodType);
|
||||
sItemResRefExceptional = CraftLookup("wbwxh003",iWoodType);
|
||||
sComponent1 = GetComponent(iWoodType);
|
||||
iComponent1 = 6;
|
||||
}
|
||||
|
||||
sComponent1Name = GetComponentName(iWoodType);
|
||||
|
||||
// check for components
|
||||
if (GetNumItems(oPC,sComponent1) < iComponent1)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent1Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
if (iComponent2 > 0)
|
||||
{
|
||||
if (GetNumItems(oPC,sComponent2) < iComponent2)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent2Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iComponent3 > 0)
|
||||
{
|
||||
if (GetNumItems(oPC,sComponent3) < iComponent3)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent3Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// visual and audio crafting effects
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,12.0));
|
||||
PlaySound("al_cv_fanlg1");
|
||||
PlaySound("al_cv_millwheel1");
|
||||
PlaySound("al_mg_pillrlght1");
|
||||
DelayCommand(6.0,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(6.0,PlaySound("al_cv_millwheel1"));
|
||||
DelayCommand(6.0,PlaySound("al_mg_pillrlght1"));
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF,FALSE),OBJECT_SELF,1.0);
|
||||
DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_ORANGE,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(3.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(5.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(7.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(9.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(11.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF,FALSE),OBJECT_SELF,1.0));
|
||||
|
||||
|
||||
// Remove all components
|
||||
if (iComponent1Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent1);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent1)
|
||||
{
|
||||
iComponent1 = iComponent1 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent1,iComponent1,1,sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent1)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent1;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent1; iComponent1>0; iComponent1--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent1);
|
||||
}
|
||||
}
|
||||
if (sComponent2 != "")
|
||||
{
|
||||
if (iComponent2Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent2);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent2)
|
||||
{
|
||||
iComponent2 = iComponent2 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent2,iComponent2,1, sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent2)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent2;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent2; iComponent2>0; iComponent2--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sComponent3 != "")
|
||||
{
|
||||
if (iComponent3Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent3);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent3)
|
||||
{
|
||||
iComponent3 = iComponent3 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent3,iComponent3,1, sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent3)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent3;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent3; iComponent3>0; iComponent3--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
iBowChance = iBowChance - iDifficulty;
|
||||
|
||||
if (iBowChance <1) iBowChance = 1;
|
||||
|
||||
iRandom = Random(1000);
|
||||
if (iRandom <= iBowChance)
|
||||
{
|
||||
iSuccess = 1;
|
||||
int iSuccess2 = 1;
|
||||
iBowChance = iBowChance - 50;
|
||||
if (Random(1000) <= iBowChance) iSuccess2 = iSuccess2+1;
|
||||
iBowChance = iBowChance-100;
|
||||
if (Random(1000) <= iBowChance) iSuccess2 = iSuccess2+1;
|
||||
iBowChance = iBowChance + 150;
|
||||
if (iSuccess2 == 1)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefPoor,oPC,1)));
|
||||
if (iSuccess2 == 2)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRef,oPC,1)));
|
||||
if (iSuccess2 == 3)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefExceptional,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
if (Random(1000) >= iBowSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iBowChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
||||
return;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iBowSkill++;
|
||||
sOldSkill2 = IntToString(iBowSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iBowSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iBowSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(13.0,SetTokenPair(oPC,13,3,iBowSkill));
|
||||
|
||||
//NWN database
|
||||
//DelayCommand(13.0,SetCampaignInt("UOACraft","iBowSkill",iBowSkill,oPC));
|
||||
|
||||
//external database
|
||||
DelayCommand(13.0,SetPersistentInt(oPC,"iBowSkill",iBowSkill,0,"UOACraft"));
|
||||
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"==================================="));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in bowcraft has gone up!"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"Current bowcraft skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"==================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(14.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
//ensure at least 1 respawn 10 minutes after used...
|
||||
//this is to prevent a broken placeable that is used, with a 'in use' delay
|
||||
//which would cancel the respawn
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmSetToRespawn")!=99)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"iAmSetToRespawn",99);
|
||||
DelayCommand(600.0,ExecuteScript("_onclose_clear",OBJECT_SELF));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
int iStackCount = GetNumStackedItems(oTemp);
|
||||
int iTemp = iCount - iStackCount;
|
||||
iStackCount = iStackCount-iCount;
|
||||
DestroyObject(oTemp);
|
||||
if (iStackCount > 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount));
|
||||
DelayCommand(1.0,CreateAnObject(sStackResRef,oPC,iStackCount));
|
||||
}
|
||||
// this next line *should* recursively call this function if the number of
|
||||
// stacked items does not meet the required number of items to be destroyed.
|
||||
if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode, sStackResRef));
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
DestroyObject(oTemp);
|
||||
return;
|
||||
}
|
||||
|
||||
string GetComponent(int iWoodType)
|
||||
{
|
||||
switch (iWoodType)
|
||||
{
|
||||
case 1:{return "WOOD_OLIVE"; break;}
|
||||
case 2:{return "WOOD_WILLOW"; break;}
|
||||
case 3:{return "WOOD_PINE"; break;}
|
||||
case 4:{return "WOOD_FIR"; break;}
|
||||
case 5:{return "WOOD_MANGROVE"; break;}
|
||||
case 6:{return "WOOD_CHERRY"; break;}
|
||||
case 7:{return "WOOD_MAPLE"; break;}
|
||||
case 8:{return "WOOD_ALMOND"; break;}
|
||||
case 9:{return "WOOD_HICKORY"; break;}
|
||||
case 10:{return "WOOD_BIRCH"; break;}
|
||||
case 11:{return "WOOD_ELDER"; break;}
|
||||
case 12:{return "WOOD_WALNUT"; break;}
|
||||
case 13:{return "WOOD_ELM"; break;}
|
||||
case 14:{return "WOOD_MAHOGANY"; break;}
|
||||
case 15:{return "WOOD_OAK"; break;}
|
||||
case 16:{return "WOOD_YEW"; break;}
|
||||
case 17:{return "WOOD_REDWOOD"; break;}
|
||||
case 18:{return "WOOD_IRONWOOD"; break;}
|
||||
default:{return "WOOD_NORMAL"; break;}
|
||||
}
|
||||
return "WOOD_NORMAL";
|
||||
}
|
||||
|
||||
string GetComponentName(int iWoodType)
|
||||
{
|
||||
switch (iWoodType)
|
||||
{
|
||||
case 1:{return "olive branches"; break;}
|
||||
case 2:{return "willow branches"; break;}
|
||||
case 3:{return "pine logs"; break;}
|
||||
case 4:{return "fir logs"; break;}
|
||||
case 5:{return "mangrove logs"; break;}
|
||||
case 6:{return "cherry logs"; break;}
|
||||
case 7:{return "maple logs"; break;}
|
||||
case 8:{return "almond logs"; break;}
|
||||
case 9:{return "hickory logs"; break;}
|
||||
case 10:{return "birch logs"; break;}
|
||||
case 11:{return "elder logs"; break;}
|
||||
case 12:{return "walnut logs"; break;}
|
||||
case 13:{return "elm logs"; break;}
|
||||
case 14:{return "mahogany logs"; break;}
|
||||
case 15:{return "oak logs"; break;}
|
||||
case 16:{return "yew branches"; break;}
|
||||
case 17:{return "redwood"; break;}
|
||||
case 18:{return "ironwood"; break;}
|
||||
default:{return "normal logs"; break;}
|
||||
}
|
||||
return "normal logs";
|
||||
}
|
||||
|
||||
string CraftLookup(string sResRef, int iWoodType)
|
||||
{
|
||||
switch (iWoodType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
return sResRef;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// Olive Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh005";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh004";
|
||||
if (sResRef=="wbwsh003") return "wbwsh006";
|
||||
// Olive Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln005";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln004";
|
||||
if (sResRef=="wbwln003") return "wbwln006";
|
||||
// Olive Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl005";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl006";
|
||||
if (sResRef=="wbwxl003") return "wbwxl033";
|
||||
// Olive Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh005";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh004";
|
||||
if (sResRef=="wbwxh003") return "wbwxh006";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// Willow Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh008";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh007";
|
||||
if (sResRef=="wbwsh003") return "wbwsh009";
|
||||
// Willow Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln008";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln007";
|
||||
if (sResRef=="wbwln003") return "wbwln009";
|
||||
// Willow Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl007";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl004";
|
||||
if (sResRef=="wbwxl003") return "wbwxl038";
|
||||
// willow Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh008";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh007";
|
||||
if (sResRef=="wbwxh003") return "wbwxh009";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
// Pine Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh011";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh010";
|
||||
if (sResRef=="wbwsh003") return "wbwsh012";
|
||||
// Pine Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln011";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln010";
|
||||
if (sResRef=="wbwln003") return "wbwln012";
|
||||
// Pine Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl010";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl009";
|
||||
if (sResRef=="wbwxl003") return "wbwxl011";
|
||||
// pine Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh011";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh010";
|
||||
if (sResRef=="wbwxh003") return "wbwxh012";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
// Fir Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh014";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh013";
|
||||
if (sResRef=="wbwsh003") return "wbwsh015";
|
||||
// Fir Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln014";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln013";
|
||||
if (sResRef=="wbwln003") return "wbwln015";
|
||||
// Fir Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl013";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl012";
|
||||
if (sResRef=="wbwxl003") return "wbwxl014";
|
||||
// Fir Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh014";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh013";
|
||||
if (sResRef=="wbwxh003") return "wbwxh015";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
// Mangrove Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh017";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh016";
|
||||
if (sResRef=="wbwsh003") return "wbwsh018";
|
||||
// Mangrove Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln017";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln016";
|
||||
if (sResRef=="wbwln003") return "wbwln018";
|
||||
// Mangrove Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl016";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl015";
|
||||
if (sResRef=="wbwxl003") return "wbwxl017";
|
||||
// Mangrove Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh017";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh016";
|
||||
if (sResRef=="wbwxh003") return "wbwxh018";
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
// Cherry Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh020";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh019";
|
||||
if (sResRef=="wbwsh003") return "wbwsh021";
|
||||
// Cherry Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln020";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln019";
|
||||
if (sResRef=="wbwln003") return "wbwln021";
|
||||
// Cherry Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl019";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl018";
|
||||
if (sResRef=="wbwxl003") return "wbwxl020";
|
||||
// Cherry Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh020";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh019";
|
||||
if (sResRef=="wbwxh003") return "wbwxh021";
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
// Maple Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh023";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh022";
|
||||
if (sResRef=="wbwsh003") return "wbwsh024";
|
||||
// Maple Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln023";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln022";
|
||||
if (sResRef=="wbwln003") return "wbwln024";
|
||||
// Maple Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl022";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl021";
|
||||
if (sResRef=="wbwxl003") return "wbwxl023";
|
||||
// Maple Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh023";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh022";
|
||||
if (sResRef=="wbwxh003") return "wbwxh024";
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
// Almond Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh026";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh025";
|
||||
if (sResRef=="wbwsh003") return "wbwsh027";
|
||||
// Almond Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln026";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln025";
|
||||
if (sResRef=="wbwln003") return "wbwln027";
|
||||
// Almond Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl025";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl024";
|
||||
if (sResRef=="wbwxl003") return "wbwxl026";
|
||||
// Almond Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh026";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh025";
|
||||
if (sResRef=="wbwxh003") return "wbwxh027";
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
// Hickory Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh029";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh028";
|
||||
if (sResRef=="wbwsh003") return "wbwsh030";
|
||||
// Hickory Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln029";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln028";
|
||||
if (sResRef=="wbwln003") return "wbwln030";
|
||||
// Hickory Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl028";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl027";
|
||||
if (sResRef=="wbwxl003") return "wbwxl029";
|
||||
// Hickory Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh029";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh028";
|
||||
if (sResRef=="wbwxh003") return "wbwxh030";
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
// Birch Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh032";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh031";
|
||||
if (sResRef=="wbwsh003") return "wbwsh033";
|
||||
// Birch Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln032";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln031";
|
||||
if (sResRef=="wbwln003") return "wbwln033";
|
||||
// Birch Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl031";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl030";
|
||||
if (sResRef=="wbwxl003") return "wbwxl032";
|
||||
// Birch Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh032";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh031";
|
||||
if (sResRef=="wbwxh003") return "wbwxh033";
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
// Elder Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh035";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh034";
|
||||
if (sResRef=="wbwsh003") return "wbwsh036";
|
||||
// Elder Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln035";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln034";
|
||||
if (sResRef=="wbwln003") return "wbwln036";
|
||||
// Elder Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl035";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl034";
|
||||
if (sResRef=="wbwxl003") return "wbwxl036";
|
||||
// Elder Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh035";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh034";
|
||||
if (sResRef=="wbwxh003") return "wbwxh036";
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
// Walnut Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh038";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh037";
|
||||
if (sResRef=="wbwsh003") return "wbwsh039";
|
||||
// Walnut Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln038";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln037";
|
||||
if (sResRef=="wbwln003") return "wbwln039";
|
||||
// Walnut Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl038";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl037";
|
||||
if (sResRef=="wbwxl003") return "wbwxl039";
|
||||
// Walnut Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh038";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh037";
|
||||
if (sResRef=="wbwxh003") return "wbwxh039";
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
// Elm Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh041";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh040";
|
||||
if (sResRef=="wbwsh003") return "wbwsh042";
|
||||
// Elm Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln041";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln040";
|
||||
if (sResRef=="wbwln003") return "wbwln042";
|
||||
// Elm Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl041";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl040";
|
||||
if (sResRef=="wbwxl003") return "wbwxl042";
|
||||
// Elm Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh041";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh040";
|
||||
if (sResRef=="wbwxh003") return "wbwxh042";
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
// Mahogany Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh044";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh043";
|
||||
if (sResRef=="wbwsh003") return "wbwsh045";
|
||||
// Mahogany Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln044";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln043";
|
||||
if (sResRef=="wbwln003") return "wbwln045";
|
||||
// Mahogany Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl044";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl043";
|
||||
if (sResRef=="wbwxl003") return "wbwxl045";
|
||||
// Mahogany Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh044";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh043";
|
||||
if (sResRef=="wbwxh003") return "wbwxh045";
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
{
|
||||
// Oak Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh047";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh046";
|
||||
if (sResRef=="wbwsh003") return "wbwsh048";
|
||||
// Oak Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln047";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln046";
|
||||
if (sResRef=="wbwln003") return "wbwln048";
|
||||
// Oak Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl047";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl046";
|
||||
if (sResRef=="wbwxl003") return "wbwxl048";
|
||||
// Oak Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh047";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh046";
|
||||
if (sResRef=="wbwxh003") return "wbwxh048";
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
// Yew Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh050";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh049";
|
||||
if (sResRef=="wbwsh003") return "wbwsh051";
|
||||
// Yew Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln050";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln049";
|
||||
if (sResRef=="wbwln003") return "wbwln051";
|
||||
// Yew Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl050";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl049";
|
||||
if (sResRef=="wbwxl003") return "wbwxl051";
|
||||
// Yew Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh050";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh049";
|
||||
if (sResRef=="wbwxh003") return "wbwxh051";
|
||||
break;
|
||||
}
|
||||
case 17:
|
||||
{
|
||||
// Redwood Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh053";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh052";
|
||||
if (sResRef=="wbwsh003") return "wbwsh054";
|
||||
// Redwood Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln053";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln052";
|
||||
if (sResRef=="wbwln003") return "wbwln054";
|
||||
// Redwood Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl053";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl052";
|
||||
if (sResRef=="wbwxl003") return "wbwxl054";
|
||||
// Redwood Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh053";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh052";
|
||||
if (sResRef=="wbwxh003") return "wbwxh054";
|
||||
break;
|
||||
}
|
||||
case 18:
|
||||
{
|
||||
// Ironwood Shortbow
|
||||
if (sResRef=="wbwsh002") return "wbwsh056";
|
||||
if (sResRef=="nw_wbwsh001") return "wbwsh055";
|
||||
if (sResRef=="wbwsh003") return "wbwsh057";
|
||||
// Ironwood Longbow
|
||||
if (sResRef=="wbwln002") return "wbwln056";
|
||||
if (sResRef=="nw_wbwln001") return "wbwln055";
|
||||
if (sResRef=="wbwln003") return "wbwln057";
|
||||
// Ironwood Light Crossbow
|
||||
if (sResRef=="wbwxl002") return "wbwxl056";
|
||||
if (sResRef=="nw_wbwxl001") return "wbwxl055";
|
||||
if (sResRef=="wbwxl003") return "wbwxl057";
|
||||
// Ironwood Heavy Crossbow
|
||||
if (sResRef=="wbwxh002") return "wbwxh056";
|
||||
if (sResRef=="nw_wbwxh001") return "wbwxh055";
|
||||
if (sResRef=="wbwxh003") return "wbwxh057";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return sResRef;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sResRef;
|
||||
}
|
1219
_module/nss/_craft_brewvat.nss
Normal file
1219
_module/nss/_craft_brewvat.nss
Normal file
File diff suppressed because it is too large
Load Diff
794
_module/nss/_craft_carpentry.nss
Normal file
794
_module/nss/_craft_carpentry.nss
Normal file
@@ -0,0 +1,794 @@
|
||||
#include "nw_i0_plot"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef);
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag);
|
||||
string GetComponent(int iWoodType);
|
||||
string GetComponentName(int iWoodType);
|
||||
string CraftLookup(string sResRef, int iWoodType);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oSelf = OBJECT_SELF;
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
object oPC = GetLastDisturbed();
|
||||
string sTag = GetTag(oItem);
|
||||
string sSuccess = "";
|
||||
string sFail = "";
|
||||
string sItemResRef = "";
|
||||
string sItemResRefPoor = "";
|
||||
string sItemResRefExceptional = "";
|
||||
int iRandom = 0;
|
||||
int iSuccess = 0;
|
||||
int iSkillGain = 0;
|
||||
int iComponent1 = 1;
|
||||
int iComponent2 = 0;
|
||||
int iComponent3 = 0;
|
||||
int iComponent1Stackable = 1;
|
||||
int iComponent2Stackable = 0;
|
||||
int iComponent3Stackable = 0;
|
||||
int iStackSize = 0;
|
||||
int iWoodType = GetLocalInt(oPC,"iUseThisWood"); // Credit to Lau3 for reporting this spacing error "iUseThis Wood".
|
||||
int iPenalty = iWoodType*10;
|
||||
int iDifficulty = 0;
|
||||
string sComponent1 = "";
|
||||
string sComponent2 = "";
|
||||
string sComponent3 = "";
|
||||
string sComponent1Name = "";
|
||||
string sComponent2Name = "";
|
||||
string sComponent3Name = "";
|
||||
string sComponentResRef = "";
|
||||
object oTemp = OBJECT_INVALID;
|
||||
|
||||
|
||||
if (GetInventoryDisturbType()== INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You can only craft by removing pattern tokens from this station.",oPC,FALSE);
|
||||
}
|
||||
|
||||
if (GetStringLeft(GetResRef(oItem),10)=="flagswitch")
|
||||
{
|
||||
if (sTag == "SWITCH_WOOD1") SetLocalInt(oPC,"iUseThisWood",0);
|
||||
if (sTag == "SWITCH_WOOD2") SetLocalInt(oPC,"iUseThisWood",1);
|
||||
if (sTag == "SWITCH_WOOD3") SetLocalInt(oPC,"iUseThisWood",2);
|
||||
if (sTag == "SWITCH_WOOD4") SetLocalInt(oPC,"iUseThisWood",3);
|
||||
if (sTag == "SWITCH_WOOD5") SetLocalInt(oPC,"iUseThisWood",4);
|
||||
if (sTag == "SWITCH_WOOD6") SetLocalInt(oPC,"iUseThisWood",5);
|
||||
if (sTag == "SWITCH_WOOD7") SetLocalInt(oPC,"iUseThisWood",6);
|
||||
if (sTag == "SWITCH_WOOD8") SetLocalInt(oPC,"iUseThisWood",7);
|
||||
if (sTag == "SWITCH_WOOD9") SetLocalInt(oPC,"iUseThisWood",8);
|
||||
if (sTag == "SWITCH_WOOD10") SetLocalInt(oPC,"iUseThisWood",9);
|
||||
if (sTag == "SWITCH_WOOD11") SetLocalInt(oPC,"iUseThisWood",10);
|
||||
if (sTag == "SWITCH_WOOD12") SetLocalInt(oPC,"iUseThisWood",11);
|
||||
if (sTag == "SWITCH_WOOD13") SetLocalInt(oPC,"iUseThisWood",12);
|
||||
if (sTag == "SWITCH_WOOD14") SetLocalInt(oPC,"iUseThisWood",13);
|
||||
if (sTag == "SWITCH_WOOD15") SetLocalInt(oPC,"iUseThisWood",14);
|
||||
if (sTag == "SWITCH_WOOD16") SetLocalInt(oPC,"iUseThisWood",15);
|
||||
if (sTag == "SWITCH_WOOD17") SetLocalInt(oPC,"iUseThisWood",16);
|
||||
if (sTag == "SWITCH_WOOD18") SetLocalInt(oPC,"iUseThisWood",17);
|
||||
if (sTag == "SWITCH_WOOD19") SetLocalInt(oPC,"iUseThisWood",18);
|
||||
string sWoodMessage = "Switching wood types. now set to "+GetStringLowerCase(GetName(oItem))+".";
|
||||
FloatingTextStringOnCreature(sWoodMessage,oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
string sTagSelf = GetTag(oSelf);
|
||||
AssignCommand(oPC,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE));
|
||||
AssignCommand(oPC,DelayCommand(1.5,DoPlaceableObjectAction(GetNearestObjectByTag(sTagSelf,oPC,1),PLACEABLE_ACTION_USE)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetStringLeft(GetResRef(oItem),7)!="pattern") return;
|
||||
CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem));
|
||||
DestroyObject(oItem);
|
||||
|
||||
if (GetItemPossessedBy(oPC,"Carpenters_Tools")==OBJECT_INVALID)
|
||||
{
|
||||
SendMessageToPC(oPC,"You must have carpenters tools in order to create anything here.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You must wait till the current club, quarterstaff, or torch is completed before starting another.");
|
||||
return;
|
||||
}
|
||||
|
||||
// nwn database
|
||||
//int iCarpentrySkill = GetCampaignInt("UOACraft","iCarpentrySkill",oPC);
|
||||
|
||||
//external database
|
||||
int iCarpentrySkill = GetPersistentInt(oPC,"iCarpentrySkill","UOACraft");
|
||||
|
||||
int iCarpentryChance = iCarpentrySkill;
|
||||
|
||||
|
||||
if (GetItemPossessedBy(oPC,"NoDrop_SkillLogBook")==OBJECT_INVALID)
|
||||
{
|
||||
CreateItemOnObject("skilllogbook",oPC,1);
|
||||
}
|
||||
|
||||
if (iCarpentryChance < 350)
|
||||
{
|
||||
iCarpentryChance = GetAbilityScore(oPC,ABILITY_STRENGTH)*5;
|
||||
iCarpentryChance = iCarpentryChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
|
||||
iCarpentryChance = iCarpentryChance+(GetAbilityScore(oPC,ABILITY_CONSTITUTION)*2);
|
||||
iCarpentryChance = iCarpentryChance*3;
|
||||
if (iCarpentryChance>350)iCarpentryChance=350;
|
||||
if (iCarpentrySkill > iCarpentryChance) iCarpentryChance=iCarpentrySkill;
|
||||
}
|
||||
|
||||
iCarpentryChance = iCarpentryChance - iPenalty;
|
||||
|
||||
|
||||
if (sTag == "pattern103") //club
|
||||
{
|
||||
iPenalty=200;
|
||||
sSuccess = "You successfully form and shape the wood into a club.";
|
||||
sFail = "You are unable to shape and form the wood properly, and the club is ruined.";
|
||||
sItemResRefPoor = CraftLookup("wblcl002",iWoodType);
|
||||
sItemResRef = CraftLookup("nw_wblcl001",iWoodType);
|
||||
sItemResRefExceptional = CraftLookup("wblcl003",iWoodType);
|
||||
sComponent1 = GetComponent(iWoodType);
|
||||
iComponent1 = 2;
|
||||
}
|
||||
|
||||
if (sTag == "pattern104") //quarterstaff
|
||||
{
|
||||
iPenalty = 300;
|
||||
sSuccess = "You successfully form and shape the wood into a quarterstaff.";
|
||||
sFail = "You are unable to shape and form the wood properly, and the quarterstaff is ruined.";
|
||||
sItemResRefPoor = CraftLookup("wdbqs002",iWoodType);
|
||||
sItemResRef = CraftLookup("nw_wdbqs001",iWoodType);
|
||||
sItemResRefExceptional = CraftLookup("wdbqs003",iWoodType);
|
||||
sComponent1 = GetComponent(iWoodType);
|
||||
iComponent1 = 3;
|
||||
}
|
||||
|
||||
if (sTag == "pattern109") //torches
|
||||
{
|
||||
iDifficulty = -50; //bonus of 5.0 skill to make torches
|
||||
sSuccess = "You successfully form and shape the wood, combining the straw and tar into torches.";
|
||||
sFail = "You are unable to create the torches, instead causing a sticky mess.";
|
||||
sItemResRef = "nw_it_torch001";
|
||||
sComponent1 = "WOOD_NORMAL"; //Normal Wood
|
||||
iComponent1 = 1;
|
||||
sComponent2 = "ITEM_STRAW"; //Bundle of Straw
|
||||
iComponent2 = 1;
|
||||
sComponent3 = "_UOA_BOTTLE_TAR"; //Bottle of Tar
|
||||
iComponent3 = 1;
|
||||
iComponent3Stackable=1;
|
||||
sComponent1Name="normal wood";
|
||||
sComponent2Name="bundles of straw";
|
||||
sComponent3Name="bottles of tar";
|
||||
}
|
||||
|
||||
if (sTag == "pattern117") //Wine Cask
|
||||
{
|
||||
iDifficulty = 400;
|
||||
sSuccess = "You successfully form and shape the wood into an empty wine cask.";
|
||||
sFail = "The wood warps, rendering the wine cask unuseable.";
|
||||
sItemResRef = "item_cask_001"; //empty wine cask
|
||||
sItemResRefPoor = sItemResRef;
|
||||
sItemResRefExceptional = sItemResRef;
|
||||
sComponent1 = "WOOD_NORMAL"; //Normal Wood
|
||||
iComponent1 = 6;
|
||||
sComponent1Name="normal wood";
|
||||
}
|
||||
if (sTag == "pattern118") //Beer barrel
|
||||
{
|
||||
iDifficulty = 450;
|
||||
sSuccess = "You successfully form and shape the wood into an empty beer barrel.";
|
||||
sFail = "The wood warps, rendering the beer barrel unuseable.";
|
||||
sItemResRef = "item_cask_002"; //empty wine cask
|
||||
sItemResRefPoor = sItemResRef;
|
||||
sItemResRefExceptional = sItemResRef;
|
||||
sComponent1 = "WOOD_NORMAL"; //Normal Wood
|
||||
iComponent1 = 8;
|
||||
sComponent1Name="normal wood";
|
||||
}
|
||||
if (sTag == "pattern119") //Mead barrel
|
||||
{
|
||||
iDifficulty = 400;
|
||||
sSuccess = "You successfully form and shape the wood into an empty mead barrel.";
|
||||
sFail = "The wood warps, rendering the mead barrel unuseable.";
|
||||
sItemResRef = "item_cask_003"; //empty wine cask
|
||||
sItemResRefPoor = sItemResRef;
|
||||
sItemResRefExceptional = sItemResRef;
|
||||
sComponent1 = "WOOD_MAPLE"; //Maple Wood
|
||||
iComponent1 = 8;
|
||||
sComponent1Name="maple wood";
|
||||
}
|
||||
if (sTag == "pattern120") //Whiskey barrel
|
||||
{
|
||||
iDifficulty = 200;
|
||||
sSuccess = "You successfully form and shape the wood into an empty whiskey barrel.";
|
||||
sFail = "The wood warps, rendering the whiskey barrel unuseable.";
|
||||
sItemResRef = "item_cask_004"; //empty wine cask
|
||||
sItemResRefPoor = sItemResRef;
|
||||
sItemResRefExceptional = sItemResRef;
|
||||
sComponent1 = "WOOD_OAK"; //Maple Wood
|
||||
iComponent1 = 8;
|
||||
sComponent1Name="oak wood";
|
||||
}
|
||||
if (sTag == "pattern121") //Rum barrel
|
||||
{
|
||||
iDifficulty = 300;
|
||||
sSuccess = "You successfully form and shape the wood into an empty rum barrel.";
|
||||
sFail = "The wood warps, rendering the rum barrel unuseable.";
|
||||
sItemResRef = "item_cask_005"; //empty wine cask
|
||||
sItemResRefPoor = sItemResRef;
|
||||
sItemResRefExceptional = sItemResRef;
|
||||
sComponent1 = "WOOD_OAK"; //Maple Wood
|
||||
iComponent1 = 8;
|
||||
sComponent2 = "_UOA_BOTTLE_TAR"; //Bottle of Tar
|
||||
iComponent2 = 1;
|
||||
iComponent2Stackable=1;
|
||||
sComponent1Name="oak wood";
|
||||
sComponent2Name="bottles of tar";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (sTag=="pattern103")sComponent1Name = GetComponentName(iWoodType);
|
||||
if (sTag=="pattern104")sComponent1Name = GetComponentName(iWoodType);
|
||||
// check for components
|
||||
if (GetNumItems(oPC,sComponent1) < iComponent1)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent1Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
if (iComponent2 > 0)
|
||||
{
|
||||
if (GetNumItems(oPC,sComponent2) < iComponent2)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent2Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iComponent3 > 0)
|
||||
{
|
||||
if (GetNumItems(oPC,sComponent3) < iComponent3)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent3Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all components
|
||||
if (iComponent1Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent1);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent1)
|
||||
{
|
||||
iComponent1 = iComponent1 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent1,iComponent1,1,sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent1)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent1;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent1; iComponent1>0; iComponent1--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent1);
|
||||
}
|
||||
}
|
||||
if (sComponent2 != "")
|
||||
{
|
||||
if (iComponent2Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent2);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent2)
|
||||
{
|
||||
iComponent2 = iComponent2 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent2,iComponent2,1, sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent2)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent2;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent2; iComponent2>0; iComponent2--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sComponent3 != "")
|
||||
{
|
||||
if (iComponent3Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent3);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent3)
|
||||
{
|
||||
iComponent3 = iComponent3 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent3,iComponent3,1, sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent3)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent3;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent3; iComponent3>0; iComponent3--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iCarpentryChance = iCarpentryChance - iDifficulty;
|
||||
if (iCarpentryChance <1) iCarpentryChance = 1;
|
||||
|
||||
PlaySound("as_cv_sawing1");
|
||||
DelayCommand(3.0,PlaySound("as_cv_sawing1"));
|
||||
DelayCommand(6.0,PlaySound("as_cv_sawing2"));
|
||||
DelayCommand(9.0,PlaySound("as_cv_hammering1"));
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,13.0));
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(13.1,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
|
||||
iRandom = Random(1000);
|
||||
if (iRandom <= iCarpentryChance)
|
||||
{
|
||||
iSuccess = 1;
|
||||
int iSuccess2 = 1;
|
||||
if (sTag!="pattern109") // non-torches
|
||||
{
|
||||
iCarpentryChance = iCarpentryChance - 50;
|
||||
if (Random(1000) <= iCarpentryChance) iSuccess2 = iSuccess2+1;
|
||||
iCarpentryChance = iCarpentryChance-100;
|
||||
if (Random(1000) <= iCarpentryChance) iSuccess2 = iSuccess2+1;
|
||||
iCarpentryChance = iCarpentryChance + 150;
|
||||
if (iSuccess2 == 1)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefPoor,oPC,1)));
|
||||
if (iSuccess2 == 2)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRef,oPC,1)));
|
||||
if (iSuccess2 == 3)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefExceptional,oPC,1)));
|
||||
}
|
||||
if (sTag=="pattern109") //torches
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.1,CreateAnObject(sItemResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.2,CreateAnObject(sItemResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.3,CreateAnObject(sItemResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.4,CreateAnObject(sItemResRef,oPC,1)));
|
||||
}
|
||||
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
if (Random(1000) >= iCarpentrySkill)
|
||||
{
|
||||
if (d10(1)+1 >= iCarpentryChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
||||
return;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iCarpentrySkill++;
|
||||
sOldSkill2 = IntToString(iCarpentrySkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iCarpentrySkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iCarpentrySkill <= 1000)
|
||||
{
|
||||
|
||||
//nwn database
|
||||
//DelayCommand(13.0,SetCampaignInt("UOACraft","iCarpentrySkill",iCarpentrySkill,oPC));
|
||||
|
||||
//external database
|
||||
DelayCommand(13.0,SetPersistentInt(oPC,"iCarpentrySkill",iCarpentrySkill,0,"UOACraft"));
|
||||
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"==================================="));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in carpentry has gone up!"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"Current carpentry skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"==================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ensure at least 1 respawn 10 minutes after used...
|
||||
//this is to prevent a broken placeable that is used, with a 'in use' delay
|
||||
//which would cancel the respawn
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmSetToRespawn")!=99)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"iAmSetToRespawn",99);
|
||||
DelayCommand(600.0,ExecuteScript("_onclose_clear",OBJECT_SELF));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
int iStackCount = GetNumStackedItems(oTemp);
|
||||
int iTemp = iCount - iStackCount;
|
||||
iStackCount = iStackCount-iCount;
|
||||
DestroyObject(oTemp);
|
||||
if (iStackCount > 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount));
|
||||
DelayCommand(1.0,CreateAnObject(sStackResRef,oPC,iStackCount));
|
||||
}
|
||||
// this next line *should* recursively call this function if the number of
|
||||
// stacked items does not meet the required number of items to be destroyed.
|
||||
if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode, sStackResRef));
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
DestroyObject(oTemp);
|
||||
return;
|
||||
}
|
||||
|
||||
string GetComponent(int iWoodType)
|
||||
{
|
||||
switch (iWoodType)
|
||||
{
|
||||
case 1:{return "WOOD_OLIVE"; break;}
|
||||
case 2:{return "WOOD_WILLOW"; break;}
|
||||
case 3:{return "WOOD_PINE"; break;}
|
||||
case 4:{return "WOOD_FIR"; break;}
|
||||
case 5:{return "WOOD_MANGROVE"; break;}
|
||||
case 6:{return "WOOD_CHERRY"; break;}
|
||||
case 7:{return "WOOD_MAPLE"; break;}
|
||||
case 8:{return "WOOD_ALMOND"; break;}
|
||||
case 9:{return "WOOD_HICKORY"; break;}
|
||||
case 10:{return "WOOD_BIRCH"; break;}
|
||||
case 11:{return "WOOD_ELDER"; break;}
|
||||
case 12:{return "WOOD_WALNUT"; break;}
|
||||
case 13:{return "WOOD_ELM"; break;}
|
||||
case 14:{return "WOOD_MAHOGANY"; break;}
|
||||
case 15:{return "WOOD_OAK"; break;}
|
||||
case 16:{return "WOOD_YEW"; break;}
|
||||
case 17:{return "WOOD_REDWOOD"; break;}
|
||||
case 18:{return "WOOD_IRONWOOD"; break;}
|
||||
default:{return "WOOD_NORMAL"; break;}
|
||||
}
|
||||
return "WOOD_NORMAL";
|
||||
}
|
||||
|
||||
string GetComponentName(int iWoodType)
|
||||
{
|
||||
switch (iWoodType)
|
||||
{
|
||||
case 1:{return "olive branches"; break;}
|
||||
case 2:{return "willow branches"; break;}
|
||||
case 3:{return "pine logs"; break;}
|
||||
case 4:{return "fir logs"; break;}
|
||||
case 5:{return "mangrove logs"; break;}
|
||||
case 6:{return "cherry logs"; break;}
|
||||
case 7:{return "maple logs"; break;}
|
||||
case 8:{return "almond logs"; break;}
|
||||
case 9:{return "hickory logs"; break;}
|
||||
case 10:{return "birch logs"; break;}
|
||||
case 11:{return "elder logs"; break;}
|
||||
case 12:{return "walnut logs"; break;}
|
||||
case 13:{return "elm logs"; break;}
|
||||
case 14:{return "mahogany logs"; break;}
|
||||
case 15:{return "oak logs"; break;}
|
||||
case 16:{return "yew branches"; break;}
|
||||
case 17:{return "redwood"; break;}
|
||||
case 18:{return "ironwood"; break;}
|
||||
default:{return "normal logs"; break;}
|
||||
}
|
||||
return "normal logs";
|
||||
}
|
||||
|
||||
|
||||
string CraftLookup(string sResRef, int iWoodType)
|
||||
{
|
||||
if (GetStringLeft(sResRef,9)=="item_cask") return sResRef;
|
||||
switch (iWoodType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
return sResRef;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// Olive Club
|
||||
if (sResRef=="wblcl002") return "wblcl005";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl004";
|
||||
if (sResRef=="wblcl003") return "wblcl006";
|
||||
// Olive Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs005";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs004";
|
||||
if (sResRef=="wdbqs003") return "wdbqs006";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// Willow Club
|
||||
if (sResRef=="wblcl002") return "wblcl008";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl007";
|
||||
if (sResRef=="wblcl003") return "wblcl009";
|
||||
// Willow Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs008";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs007";
|
||||
if (sResRef=="wdbqs003") return "wdbqs009";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
// Pine Club
|
||||
if (sResRef=="wblcl002") return "wblcl011";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl010";
|
||||
if (sResRef=="wblcl003") return "wblcl012";
|
||||
// Pine Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs011";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs010";
|
||||
if (sResRef=="wdbqs003") return "wdbqs012";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
// Fir Club
|
||||
if (sResRef=="wblcl002") return "wblcl014";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl013";
|
||||
if (sResRef=="wblcl003") return "wblcl015";
|
||||
// Fir Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs014";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs013";
|
||||
if (sResRef=="wdbqs003") return "wdbqs015";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
// Mangrove Club
|
||||
if (sResRef=="wblcl002") return "wblcl017";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl016";
|
||||
if (sResRef=="wblcl003") return "wblcl018";
|
||||
// Mangrove Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs017";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs016";
|
||||
if (sResRef=="wdbqs003") return "wdbqs018";
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
// Cherry Club
|
||||
if (sResRef=="wblcl002") return "wblcl020";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl019";
|
||||
if (sResRef=="wblcl003") return "wblcl021";
|
||||
// Cherry Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs020";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs019";
|
||||
if (sResRef=="wdbqs003") return "wdbqs021";
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
// Maple Club
|
||||
if (sResRef=="wblcl002") return "wblcl023";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl022";
|
||||
if (sResRef=="wblcl003") return "wblcl024";
|
||||
// Maple Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs023";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs022";
|
||||
if (sResRef=="wdbqs003") return "wdbqs024";
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
// Almond Club
|
||||
if (sResRef=="wblcl002") return "wblcl026";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl025";
|
||||
if (sResRef=="wblcl003") return "wblcl027";
|
||||
// Almond Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs026";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs025";
|
||||
if (sResRef=="wdbqs003") return "wdbqs027";
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
// Hickory Club
|
||||
if (sResRef=="wblcl002") return "wblcl029";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl028";
|
||||
if (sResRef=="wblcl003") return "wblcl030";
|
||||
// Hickory Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs029";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs028";
|
||||
if (sResRef=="wdbqs003") return "wdbqs030";
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
// Birch Club
|
||||
if (sResRef=="wblcl002") return "wblcl032";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl031";
|
||||
if (sResRef=="wblcl003") return "wblcl033";
|
||||
// Birch Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs032";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs031";
|
||||
if (sResRef=="wdbqs003") return "wdbqs033";
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
// Elder Club
|
||||
if (sResRef=="wblcl002") return "wblcl035";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl034";
|
||||
if (sResRef=="wblcl003") return "wblcl036";
|
||||
// Elder Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs035";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs034";
|
||||
if (sResRef=="wdbqs003") return "wdbqs036";
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
// Walnut Club
|
||||
if (sResRef=="wblcl002") return "wblcl038";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl037";
|
||||
if (sResRef=="wblcl003") return "wblcl039";
|
||||
// Walnut Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs038";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs037";
|
||||
if (sResRef=="wdbqs003") return "wdbqs039";
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
// Elm Club
|
||||
if (sResRef=="wblcl002") return "wblcl041";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl040";
|
||||
if (sResRef=="wblcl003") return "wblcl042";
|
||||
// Elm Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs041";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs040";
|
||||
if (sResRef=="wdbqs003") return "wdbqs042";
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
// Mahogany Club
|
||||
if (sResRef=="wblcl002") return "wblcl044";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl043";
|
||||
if (sResRef=="wblcl003") return "wblcl045";
|
||||
// Mahogany Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs044";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs043";
|
||||
if (sResRef=="wdbqs003") return "wdbqs045";
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
{
|
||||
// Oak Club
|
||||
if (sResRef=="wblcl002") return "wblcl047";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl046";
|
||||
if (sResRef=="wblcl003") return "wblcl048";
|
||||
// Oak Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs047";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs046";
|
||||
if (sResRef=="wdbqs003") return "wdbqs048";
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
// Yew Club
|
||||
if (sResRef=="wblcl002") return "wblcl050";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl049";
|
||||
if (sResRef=="wblcl003") return "wblcl051";
|
||||
// Yew Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs050";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs049";
|
||||
if (sResRef=="wdbqs003") return "wdbqs051";
|
||||
break;
|
||||
}
|
||||
case 17:
|
||||
{
|
||||
// Redwood Club
|
||||
if (sResRef=="wblcl002") return "wblcl053";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl052";
|
||||
if (sResRef=="wblcl003") return "wblcl054";
|
||||
// Redwood Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs053";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs052";
|
||||
if (sResRef=="wdbqs003") return "wdbqs054";
|
||||
break;
|
||||
}
|
||||
case 18:
|
||||
{
|
||||
// Ironwood Club
|
||||
if (sResRef=="wblcl002") return "wblcl056";
|
||||
if (sResRef=="nw_wblcl001") return "wblcl055";
|
||||
if (sResRef=="wblcl003") return "wblcl057";
|
||||
// Ironwood Quarterstaff
|
||||
if (sResRef=="wdbqs002") return "wdbqs056";
|
||||
if (sResRef=="nw_wdbqs001") return "wdbqs055";
|
||||
if (sResRef=="wdbqs003") return "wdbqs057";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return sResRef;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sResRef;
|
||||
}
|
614
_module/nss/_craft_cook.nss
Normal file
614
_module/nss/_craft_cook.nss
Normal file
@@ -0,0 +1,614 @@
|
||||
#include "nw_i0_plot"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef);
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag);
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastDisturbed();
|
||||
object oSelf = OBJECT_SELF;
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sTagSelf = GetTag(oSelf);
|
||||
string sItemResRef;
|
||||
|
||||
//nwn database
|
||||
//int iCookSkill = GetCampaignInt("UOACraft","iCookSkill",oPC);
|
||||
|
||||
//external database
|
||||
int iCookSkill = GetPersistentInt(oPC,"iCookSkill","UOACraft");
|
||||
|
||||
int iCookChance = iCookSkill;
|
||||
int iDifficulty;
|
||||
string sComponent1;
|
||||
string sComponent2;
|
||||
string sComponent3;
|
||||
string sComponent1Name;
|
||||
string sComponent2Name;
|
||||
string sComponent3Name;
|
||||
string sComponentResRef;
|
||||
int iComponent1;
|
||||
int iComponent2;
|
||||
int iComponent3;
|
||||
int iComponent1Stackable;
|
||||
int iComponent2Stackable;
|
||||
int iComponent3Stackable;
|
||||
int iStackSize;
|
||||
int iRandom;
|
||||
int iSkillGain;
|
||||
object oTemp;
|
||||
string sSuccess;
|
||||
string sFail;
|
||||
int iItemStackSize=1;
|
||||
|
||||
|
||||
if (iCookChance<350)
|
||||
{
|
||||
iCookChance = GetAbilityScore(oPC,ABILITY_WISDOM)*5;
|
||||
iCookChance = iCookChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
|
||||
iCookChance = iCookChance+(GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
|
||||
iCookChance = iCookChance*3;
|
||||
if (iCookChance>350)iCookChance=350;
|
||||
if (iCookSkill > iCookChance) iCookChance=iCookSkill;
|
||||
}
|
||||
|
||||
if (GetInventoryDisturbType()== INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You can only cook by selecting a recipe!",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(oSelf,"iAmInUse")!=0)
|
||||
{
|
||||
FloatingTextStringOnCreature("You can only cook one thing at a time!",oPC,FALSE);
|
||||
CopyObject(oItem,GetLocation(oSelf),oSelf,GetTag(oItem));
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
int iRecipeNumber = StringToInt(GetStringRight(sItemTag,3));
|
||||
sItemResRef = "food_"+GetStringRight(sItemTag,3);
|
||||
|
||||
iComponent1 = 1;
|
||||
iComponent2 = 0;
|
||||
iComponent3 = 0;
|
||||
sSuccess = "The meat cooks to a tender juiciness.";
|
||||
sFail = "You have burned the meat to a crisp!";
|
||||
|
||||
switch (iRecipeNumber)
|
||||
{
|
||||
case 1: //BBQ Ancient Dire Bear Meat
|
||||
{
|
||||
iDifficulty = 500;
|
||||
sComponent1 = "MEAT_ANCIENTDIREBEAR";
|
||||
sComponent1Name = "raw ancient dire bear meat";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
sComponent1 = "MEAT_BADGER";
|
||||
sComponent1Name = "raw badger meat";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
sComponent1 = "MEAT_BAT";
|
||||
sComponent1Name = "raw bat meat";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
iDifficulty = 350;
|
||||
sComponent1 = "MEAT_BLACKBEAR";
|
||||
sComponent1Name = "raw black bear meat";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
iDifficulty = 400;
|
||||
sComponent1 = "MEAT_BROWNBEAR";
|
||||
sComponent1Name = "raw brown bear meat";
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
iDifficulty = 350;
|
||||
sComponent1 = "MEAT_COUGAR";
|
||||
sComponent1Name = "raw cougar meat";
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
sComponent1 = "MEAT_COW";
|
||||
sComponent1Name = "raw cow meat";
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
sComponent1 = "MEAT_CRAGCAT";
|
||||
sComponent1Name = "raw crag cat meat";
|
||||
iDifficulty = 350;
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
sComponent1 = "MEAT_DEER";
|
||||
sComponent1Name = "raw deer meat";
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
sComponent1 = "MEAT_DIREBADGER";
|
||||
sComponent1Name = "raw dire badger meat";
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
sComponent1 = "MEAT_DIREBEAR";
|
||||
sComponent1Name = "raw dire bear meat";
|
||||
iDifficulty = 450;
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
sComponent1 = "MEAT_DIRERAT";
|
||||
sComponent1Name = "raw dire rat meat";
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
sComponent1 = "MEAT_DIRETIGER";
|
||||
sComponent1Name = "raw dire tiger meat";
|
||||
iDifficulty = 450;
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
sComponent1 = "MEAT_DIREWOLF";
|
||||
sComponent1Name = "raw dire wolf meat";
|
||||
iDifficulty = 375;
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
{
|
||||
sComponent1 = "MEAT_DOG";
|
||||
sComponent1Name = "raw dog meat";
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
sComponent1 = "MEAT_GRIZZLYBEAR";
|
||||
sComponent1Name = "raw grizzly bear meat";
|
||||
iDifficulty = 425;
|
||||
break;
|
||||
}
|
||||
case 17:
|
||||
{
|
||||
sComponent1 = "MEAT_JAGUAR";
|
||||
sComponent1Name = "raw jaguar meat";
|
||||
iDifficulty = 350;
|
||||
break;
|
||||
}
|
||||
case 18:
|
||||
{
|
||||
sComponent1 = "MEAT_LEOPARD";
|
||||
sComponent1Name = "raw leopard meat";
|
||||
iDifficulty = 375;
|
||||
break;
|
||||
}
|
||||
case 19:
|
||||
{
|
||||
sComponent1 = "MEAT_LION";
|
||||
sComponent1Name = "raw lion meat";
|
||||
iDifficulty = 400;
|
||||
break;
|
||||
}
|
||||
case 20:
|
||||
{
|
||||
sComponent1 = "MEAT_MALARPANTHER";
|
||||
sComponent1Name = "raw malar panther meat";
|
||||
iDifficulty = 475;
|
||||
break;
|
||||
}
|
||||
case 21:
|
||||
{
|
||||
sComponent1 = "MEAT_OX";
|
||||
sComponent1Name = "raw ox meat";
|
||||
break;
|
||||
}
|
||||
case 22:
|
||||
{
|
||||
sComponent1 = "MEAT_PANTHER";
|
||||
sComponent1Name = "raw panther meat";
|
||||
iDifficulty = 300;
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
sComponent1 = "MEAT_POLARBEAR";
|
||||
sComponent1Name = "raw polar bear meat";
|
||||
iDifficulty = 450;
|
||||
break;
|
||||
}
|
||||
case 24:
|
||||
{
|
||||
sComponent1 = "MEAT_RAT";
|
||||
sComponent1Name = "raw rat meat";
|
||||
break;
|
||||
}
|
||||
case 25:
|
||||
{
|
||||
sComponent1 = "MEAT_WHITESTAG";
|
||||
sComponent1Name = "raw white stag meat";
|
||||
break;
|
||||
}
|
||||
case 26:
|
||||
{
|
||||
sComponent1 = "MEAT_WINTERWOLF";
|
||||
sComponent1Name = "raw winter wolf meat";
|
||||
iDifficulty = 400;
|
||||
break;
|
||||
}
|
||||
case 27:
|
||||
{
|
||||
sComponent1 = "MEAT_WOLF";
|
||||
sComponent1Name = "raw wolf meat";
|
||||
break;
|
||||
}
|
||||
case 28:
|
||||
{
|
||||
sComponent1 = "MEAT_WORG";
|
||||
sComponent1Name = "raw worg meat";
|
||||
iDifficulty = 350;
|
||||
break;
|
||||
}
|
||||
case 29:
|
||||
{
|
||||
iComponent1Stackable=1;
|
||||
sComponent1 = "MEAT_RawFishFillet";
|
||||
sComponent1Name = "raw fish fillets";
|
||||
sSuccess = "The fillet cooks to a tender juiciness.";
|
||||
sFail = "You have burned the fillet to a crisp!";
|
||||
//iDifficulty = ;
|
||||
break;
|
||||
}
|
||||
case 30:
|
||||
{
|
||||
sComponent1 = "MEAT_WOOLYRAZORBACK";
|
||||
sComponent1Name = "wooly razorback meat";
|
||||
break;
|
||||
}
|
||||
case 31:
|
||||
case 32:
|
||||
case 33:
|
||||
case 34:
|
||||
case 35:
|
||||
case 36:
|
||||
case 37:
|
||||
case 38:
|
||||
case 39:
|
||||
case 40:
|
||||
default:
|
||||
}
|
||||
|
||||
CopyObject(oItem,GetLocation(oSelf),oSelf,GetTag(oItem));
|
||||
DestroyObject(oItem);
|
||||
|
||||
//Check for components
|
||||
if (GetNumItems(oPC,sComponent1) < iComponent1)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent1Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
if (iComponent2 > 0)
|
||||
{
|
||||
if (GetNumItems(oPC,sComponent2) < iComponent2)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent2Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iComponent3 > 0)
|
||||
{
|
||||
if (GetNumItems(oPC,sComponent3) < iComponent3)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent3Name+" to do this.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove all components
|
||||
if (iComponent1Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent1);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent1)
|
||||
{
|
||||
iComponent1 = iComponent1 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent1,iComponent1,1,sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent1)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent1;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent1; iComponent1>0; iComponent1--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent1);
|
||||
}
|
||||
}
|
||||
if (sComponent2 != "")
|
||||
{
|
||||
if (iComponent2Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent2);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent2)
|
||||
{
|
||||
iComponent2 = iComponent2 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent2,iComponent2,1, sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent2)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent2;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent2; iComponent2>0; iComponent2--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sComponent3 != "")
|
||||
{
|
||||
if (iComponent3Stackable != 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,sComponent3);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iComponent3)
|
||||
{
|
||||
iComponent3 = iComponent3 - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent3,iComponent3,1, sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iComponent3)
|
||||
{
|
||||
iStackSize = iStackSize - iComponent3;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (iComponent3; iComponent3>0; iComponent3--)
|
||||
{
|
||||
GetNextItemPossessedBy(oPC,sComponent3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetLocalInt(oSelf,"iAmInUse",99);
|
||||
DelayCommand(15.0,SetLocalInt(oSelf,"iAmInUse",0));
|
||||
|
||||
|
||||
//Assign Animations
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,15.0));
|
||||
|
||||
location lSelf = GetLocation(OBJECT_SELF);
|
||||
float fSelf = GetFacing(OBJECT_SELF)+180.0;
|
||||
vector vSelf = GetPosition(OBJECT_SELF);
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
location lFire;
|
||||
object oFire;
|
||||
if (GetStringRight(sTagSelf,1)=="1")
|
||||
{
|
||||
vFire = vSelf + (AngleToVector(fSelf) * 0.7);
|
||||
lFire = Location(oArea,vFire,fSelf);
|
||||
oFire = CreatePlaceable("plc_flamemedium", lFire, 14.3);
|
||||
}
|
||||
else
|
||||
{
|
||||
vFire = vSelf + (AngleToVector(fSelf) * 0.1);
|
||||
lFire = Location(oArea,vFire,fSelf);
|
||||
oFire = CreatePlaceable("plc_dustplume", lFire, 14.3);
|
||||
}
|
||||
DelayCommand(2.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_FIRE,FALSE),GetLocation(oFire),1.0));
|
||||
DelayCommand(5.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_PINK_ORANGE,FALSE),GetLocation(oFire),1.0));
|
||||
DelayCommand(8.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_RED_WHITE,FALSE),GetLocation(oFire),1.0));
|
||||
DelayCommand(10.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),GetLocation(oFire),1.0));
|
||||
DelayCommand(12.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_FIRE,FALSE),GetLocation(oFire),1.0));
|
||||
DelayCommand(14.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_ORANGE,FALSE),GetLocation(oFire),1.0));
|
||||
|
||||
switch (StringToInt(GetStringRight(sTagSelf,1)))
|
||||
{
|
||||
case 1: //Oven
|
||||
{
|
||||
PlaySound("al_cv_furnace1");
|
||||
PlaySound("al_cv_firelarge1");
|
||||
DelayCommand(4.5,PlaySound("al_cv_furnace1"));
|
||||
DelayCommand(4.5,PlaySound("al_cv_firelarge1"));
|
||||
DelayCommand(9.0,PlaySound("al_cv_furnace1"));
|
||||
DelayCommand(9.0,PlaySound("al_cv_firelarge1"));
|
||||
break;
|
||||
}
|
||||
case 3: //campfire & spit
|
||||
{
|
||||
PlaySound("al_cv_firepit1");
|
||||
DelayCommand(4.5,PlaySound("al_cv_firepit1"));
|
||||
DelayCommand(9.0,PlaySound("al_cv_firepit1"));
|
||||
break;
|
||||
}
|
||||
case 4: //campfire & pot
|
||||
{
|
||||
PlaySound("al_cv_firecppot1");
|
||||
DelayCommand(4.5,PlaySound("al_cv_firecppot1"));
|
||||
DelayCommand(9.0,PlaySound("al_cv_firecppot1"));
|
||||
break;
|
||||
}
|
||||
default:// campfire & perma-campfire
|
||||
{
|
||||
PlaySound("al_cv_firecamp1");
|
||||
DelayCommand(4.5,PlaySound("al_cv_firecamp1"));
|
||||
DelayCommand(9.0,PlaySound("al_cv_firecamp1"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
iCookChance=iCookChance-iDifficulty;
|
||||
if (iCookChance<1)iCookChance=1;
|
||||
|
||||
iRandom = Random(1000)+Random(1000)+Random(800);//Adjusted difficulty downwards by a small percent to make lowlevel cooks succeed a bit more.
|
||||
iRandom = iRandom/3;
|
||||
if (iRandom<=iCookChance)
|
||||
{
|
||||
if (Random(1000) >= iCookSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iCookChance/100) iSkillGain = 1;
|
||||
}
|
||||
DelayCommand(14.8,PlaySound("as_na_steamshrt2"));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(15.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(15.1,CreateAnObject(sItemResRef,oPC,iItemStackSize)));
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(14.8,PlaySound("as_cv_woodbreak3"));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(15.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
||||
return;
|
||||
}
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iCookSkill++;
|
||||
sOldSkill2 = IntToString(iCookSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iCookSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iCookSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(13.0,SetTokenPair(oPC,13,3,iCookSkill));
|
||||
|
||||
//nwn database
|
||||
//DelayCommand(14.5,SetCampaignInt("UOACraft","iCookSkill",iCookSkill,oPC));
|
||||
|
||||
//external database
|
||||
DelayCommand(14.5,SetPersistentInt(oPC,"iCookSkill",iCookSkill,0,"UOACraft"));
|
||||
|
||||
DelayCommand(14.5,SendMessageToPC(oPC,"=================================="));
|
||||
DelayCommand(14.5,SendMessageToPC(oPC,"Your skill in cooking has gone up!"));
|
||||
DelayCommand(14.5,SendMessageToPC(oPC,"Current cooking skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(14.5,SendMessageToPC(oPC,"=================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(14.4,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
int iStackCount = GetNumStackedItems(oTemp);
|
||||
int iTemp = iCount - iStackCount;
|
||||
iStackCount = iStackCount-iCount;
|
||||
DestroyObject(oTemp);
|
||||
if (iStackCount > 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount));
|
||||
DelayCommand(1.0,CreateAnObject(sStackResRef,oPC,iStackCount));
|
||||
}
|
||||
// this next line *should* recursively call this function if the number of
|
||||
// stacked items does not meet the required number of items to be destroyed.
|
||||
if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode, sStackResRef));
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
DestroyObject(oTemp);
|
||||
return;
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration)
|
||||
{
|
||||
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
||||
if (fDuration != 0.0)
|
||||
DestroyObject(oPlaceable,fDuration);
|
||||
return oPlaceable;
|
||||
}
|
440
_module/nss/_craft_digester.nss
Normal file
440
_module/nss/_craft_digester.nss
Normal file
@@ -0,0 +1,440 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sSuccess = "";
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (sItemTag!="ITEM_KINDLING")
|
||||
{
|
||||
if (GetStringLeft(sItemTag,5)!="WOOD_")
|
||||
{
|
||||
if (GetStringLeft(sItemTag,6)!="CURED_")
|
||||
{
|
||||
if (sItemTag!="SEED_RICE")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("This is not wood, kindling, rice or a cured hide...",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("The digester is not yet ready to process more materials...",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
object oAcid = GetItemPossessedBy(oPC,"ACID_MODERATE");
|
||||
if (oAcid == OBJECT_INVALID)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You must have some moderate acid in order to activate the digester.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
//int iPaperSkill = GetTokenPair(oPC,13,13);
|
||||
|
||||
//nwn database
|
||||
//int iPaperSkill = GetCampaignInt("UOACraft","iPaperSkill",oPC);
|
||||
|
||||
//external database
|
||||
int iPaperSkill = GetPersistentInt(oPC,"iPaperSkill","UOACraft");
|
||||
|
||||
int iPaperChance = iPaperSkill;
|
||||
if (iPaperSkill <350)
|
||||
{
|
||||
iPaperChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iPaperChance = iPaperChance + (GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iPaperChance = iPaperChance + (GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
|
||||
iPaperChance = iPaperChance *3;
|
||||
if (iPaperChance>350)iPaperChance = 350;
|
||||
if (iPaperSkill>iPaperChance) iPaperChance = iPaperSkill;
|
||||
}
|
||||
|
||||
|
||||
int iProduct = 0;
|
||||
int iDifficulty = 0;
|
||||
string sProduct = "pulp_wood_raw";
|
||||
string sItemTag2 = sItemTag;
|
||||
sItemTag = GetStringRight(sItemTag,GetStringLength(sItemTag)-5);
|
||||
|
||||
if (sItemTag=="KINDLING")iProduct = 1;
|
||||
if (sItemTag=="RICE")
|
||||
{
|
||||
iProduct=2;
|
||||
sProduct = "pulp_rice_raw";
|
||||
}
|
||||
if (sItemTag=="NORMAL") iProduct = 3;
|
||||
if (sItemTag=="OLIVE") iProduct = 3;
|
||||
|
||||
if (sItemTag=="WILLOW")
|
||||
{
|
||||
iProduct = 5;
|
||||
iDifficulty = 100;
|
||||
}
|
||||
if (sItemTag=="PINE")
|
||||
{
|
||||
iProduct = 5;
|
||||
iDifficulty = 100;
|
||||
}
|
||||
if (sItemTag=="FIR")
|
||||
{
|
||||
iProduct = 5;
|
||||
iDifficulty = 100;
|
||||
}
|
||||
if (sItemTag=="MANGROVE")
|
||||
{
|
||||
iProduct = 5;
|
||||
iDifficulty = 100;
|
||||
}
|
||||
|
||||
if (sItemTag=="CHERRY")
|
||||
{
|
||||
iProduct = 7;
|
||||
iDifficulty = 200;
|
||||
}
|
||||
if (sItemTag=="MAPLE")
|
||||
{
|
||||
iProduct = 7;
|
||||
iDifficulty = 200;
|
||||
}
|
||||
|
||||
|
||||
if (sItemTag=="ALMOND")
|
||||
{
|
||||
iProduct = 9;
|
||||
iDifficulty = 250;
|
||||
}
|
||||
|
||||
if (sItemTag=="HICKORY")
|
||||
{
|
||||
iProduct = 11;
|
||||
iDifficulty = 300;
|
||||
}
|
||||
|
||||
if (sItemTag=="BIRCH")
|
||||
{
|
||||
iProduct = 13;
|
||||
iDifficulty = 350;
|
||||
}
|
||||
|
||||
if (sItemTag=="ELDER")
|
||||
{
|
||||
iProduct = 15;
|
||||
iDifficulty = 400;
|
||||
}
|
||||
|
||||
if (sItemTag=="WALNUT")
|
||||
{
|
||||
iProduct = 15;
|
||||
iDifficulty = 400;
|
||||
}
|
||||
|
||||
if (sItemTag=="ELM")
|
||||
{
|
||||
iProduct = 17;
|
||||
iDifficulty = 450;
|
||||
}
|
||||
|
||||
if (sItemTag=="MAHOGANY")
|
||||
{
|
||||
iProduct = 18;
|
||||
iDifficulty = 500;
|
||||
}
|
||||
|
||||
if (sItemTag=="OAK")
|
||||
{
|
||||
iProduct = 18;
|
||||
iDifficulty = 500;
|
||||
}
|
||||
|
||||
if (sItemTag=="YEW")
|
||||
{
|
||||
iProduct = 20;
|
||||
iDifficulty = 550;
|
||||
}
|
||||
|
||||
if (sItemTag=="REDWOOD")
|
||||
{
|
||||
iProduct = 20;
|
||||
iDifficulty = 600;
|
||||
}
|
||||
|
||||
if (sItemTag=="IRONWOOD")
|
||||
{
|
||||
iProduct = 25;
|
||||
iDifficulty = 700;
|
||||
}
|
||||
|
||||
//Check to see if parchment is being attempted
|
||||
if (GetStringLeft(sItemTag2,6)=="CURED_")iProduct=1;
|
||||
if (sItemTag2=="CURED_TINY")
|
||||
{
|
||||
sProduct = "item_parchmen001";
|
||||
iDifficulty=200;
|
||||
}
|
||||
if (sItemTag2=="CURED_TINYBLACK")
|
||||
{
|
||||
sProduct = "item_parchmen002";
|
||||
iDifficulty=300;
|
||||
}
|
||||
if (sItemTag2=="CURED_TINYWHITE")
|
||||
{
|
||||
sProduct = "item_parchmen003";
|
||||
iDifficulty=400;
|
||||
}
|
||||
if (sItemTag2=="CURED_SMALL")
|
||||
{
|
||||
sProduct = "item_parchmen004";
|
||||
iDifficulty=300;
|
||||
}
|
||||
if (sItemTag2=="CURED_SMALLBLACK")
|
||||
{
|
||||
sProduct = "item_parchmen005";
|
||||
iDifficulty=400;
|
||||
}
|
||||
if (sItemTag2=="CURED_SMALLWHITE")
|
||||
{
|
||||
sProduct = "item_parchmen006";
|
||||
iDifficulty=500;
|
||||
}
|
||||
if (sItemTag2=="CURED_MEDIUM")
|
||||
{
|
||||
sProduct = "item_parchmen007";
|
||||
iDifficulty=400;
|
||||
}
|
||||
if (sItemTag2=="CURED_MEDIUMBLACK")
|
||||
{
|
||||
sProduct = "item_parchmen008";
|
||||
iDifficulty=500;
|
||||
}
|
||||
if (sItemTag2=="CURED_MEDIUMWHITE")
|
||||
{
|
||||
sProduct = "item_parchmen009";
|
||||
iDifficulty=600;
|
||||
}
|
||||
if (sItemTag2=="CURED_LARGE")
|
||||
{
|
||||
sProduct = "item_parchmen010";
|
||||
iDifficulty=500;
|
||||
}
|
||||
if (sItemTag2=="CURED_LARGEBLACK")
|
||||
{
|
||||
sProduct = "item_parchmen011";
|
||||
iDifficulty=600;
|
||||
}
|
||||
if (sItemTag2=="CURED_LARGEWHITE")
|
||||
{
|
||||
sProduct = "item_parchmen012";
|
||||
iDifficulty=700;
|
||||
}
|
||||
if (sItemTag2=="CURED_XLARGE")
|
||||
{
|
||||
sProduct = "item_parchmen013";
|
||||
iDifficulty=600;
|
||||
}
|
||||
if (sItemTag2=="CURED_XLARGEBLACK")
|
||||
{
|
||||
sProduct = "item_parchmen014";
|
||||
iDifficulty=700;
|
||||
}
|
||||
if (sItemTag2=="CURED_XLARGEWHITE")
|
||||
{
|
||||
sProduct = "item_parchmen015";
|
||||
iDifficulty=800;
|
||||
}
|
||||
|
||||
if (iPaperChance<iDifficulty)
|
||||
{
|
||||
FloatingTextStringOnCreature("You have no idea how to process this material..",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
int iAcidStack = GetNumStackedItems(oAcid)-1;
|
||||
DestroyObject(oAcid);
|
||||
if (iAcidStack >0) DelayCommand(1.0,CreateAnObject("acid002",oPC,iAcidStack));
|
||||
sSuccess = "The acid digests the material into a milky pulp....";
|
||||
if (GetStringLeft(sItemTag2,6)=="CURED_") sSuccess = "The acid digests the hairs from the hide, stripping the surface smooth.";
|
||||
// This snippet of code is cut-n-paste direct from ATS
|
||||
// Reason for this is because I had no clue how to assign an increase
|
||||
// in the z-axis of the location of the anvil for sparks to display.
|
||||
// After reading through this code, it is obvious that vEffecrPos.z
|
||||
// is the line which assigns this. Due to my own ignorance in this issue
|
||||
// I have decided to leave this snippet of code intact with this credit to
|
||||
// the original ATS script coders, whomever they may have been.
|
||||
//The only modification to this code is locAnvil was changed to locBath.
|
||||
|
||||
location locBath = GetLocation(OBJECT_SELF);
|
||||
vector vEffectPos = GetPositionFromLocation(locBath);
|
||||
vEffectPos.z += 1.0;
|
||||
location locEffect = Location( GetAreaFromLocation(locBath), vEffectPos,GetFacingFromLocation(locBath) );
|
||||
// End snippet
|
||||
|
||||
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect);
|
||||
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect);
|
||||
DelayCommand(3.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(6.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(9.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(12.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(15.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(18.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(21.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(24.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(27.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
|
||||
|
||||
DelayCommand(2.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(5.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(8.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(10.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_PINK_ORANGE),locEffect));
|
||||
DelayCommand(13.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(16.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(20.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE),locEffect));
|
||||
DelayCommand(22.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(25.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_PINK_ORANGE),locEffect));
|
||||
DelayCommand(27.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(29.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_BLUE_RED),locEffect));
|
||||
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,28.0));
|
||||
|
||||
AssignCommand(oPC,PlaySound("al_cv_firepot1"));
|
||||
AssignCommand(oPC,DelayCommand(5.9,PlaySound("al_cv_firepot1")));
|
||||
AssignCommand(oPC,DelayCommand(11.9,PlaySound("al_cv_firepot1")));
|
||||
AssignCommand(oPC,DelayCommand(17.9,PlaySound("al_cv_firepot1")));
|
||||
AssignCommand(oPC,DelayCommand(23.9,PlaySound("al_cv_firepot1")));
|
||||
|
||||
|
||||
DestroyObject(oItem);
|
||||
|
||||
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(30.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
if (GetStringLeft(sProduct,5)!="item_")
|
||||
{
|
||||
DelayCommand(30.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
||||
float fDelay = 29.0;
|
||||
for (iProduct; iProduct>0; iProduct=iProduct-10)
|
||||
{
|
||||
// SendMessageToPC(oPC,"iProduct = "+IntToString(iProduct));
|
||||
fDelay=fDelay+1.0;
|
||||
if (iProduct>10)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(fDelay,CreateAnObject(sProduct,oPC,10)));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iProduct>0) AssignCommand(oPC,DelayCommand(fDelay,CreateAnObject(sProduct,oPC,iProduct)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int iSkillGain=0;
|
||||
iPaperChance = iPaperChance-iDifficulty;
|
||||
if (Random(1000)<=iPaperChance)
|
||||
{
|
||||
if (Random(1000) >= iPaperSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iPaperChance/100) iSkillGain = 1;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iPaperSkill++;
|
||||
sOldSkill2 = IntToString(iPaperSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iPaperSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iPaperSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(30.0,SetTokenPair(oPC,13,13,iPaperSkill));
|
||||
|
||||
//nwn database
|
||||
//DelayCommand(30.0,SetCampaignInt("UOACraft","iPaperSkill",iPaperSkill,oPC));
|
||||
|
||||
//external database
|
||||
DelayCommand(30.0,SetPersistentInt(oPC,"iPaperSkill",iPaperSkill,0,"UOACraft"));
|
||||
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"======================================"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"Your skill in papermaking has gone up!"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"Current papermaking skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"======================================"));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(29.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
AssignCommand(oPC,DelayCommand(30.0,CreateAnObject(sProduct,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(29.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
}
|
||||
else
|
||||
{
|
||||
//failed
|
||||
AssignCommand(oPC,DelayCommand(29.0,FloatingTextStringOnCreature("The acid burns holes in the hide, completely ruining it.",oPC,FALSE)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
270
_module/nss/_craft_dyetub.nss
Normal file
270
_module/nss/_craft_dyetub.nss
Normal file
@@ -0,0 +1,270 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
|
||||
void main()
|
||||
{
|
||||
int iUseMode = 0;
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
iUseMode = 99;
|
||||
if (GetLastDisturbed() == OBJECT_SELF)
|
||||
{
|
||||
DestroyObject(GetInventoryDisturbItem());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
object oTemp = OBJECT_INVALID;
|
||||
object oSelf = OBJECT_SELF;
|
||||
|
||||
if (iUseMode == 0)
|
||||
{
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
if (GetStringLeft(sItemTag,4)!= "DYE_")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You can only dye cloth by placing dyes into this dyetub.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
string sTag = GetTag(oItem);
|
||||
|
||||
if (GetStringLeft(GetResRef(oItem),10)=="flagswitch")
|
||||
{
|
||||
if (sTag == "USE_CLOTH_NORMAL") SetLocalInt(oPC,"iUseThisCloth",0);
|
||||
if (sTag == "USE_CLOTH_WOOL") SetLocalInt(oPC,"iUseThisCloth",1);
|
||||
if (sTag == "USE_CLOTH_SILK") SetLocalInt(oPC,"iUseThisCloth",2);
|
||||
string sClothMessage = "Switching cloth types. Now set to "+GetStringLowerCase(GetName(oItem))+".";
|
||||
FloatingTextStringOnCreature(sClothMessage,oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
AssignCommand(oPC,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE));
|
||||
AssignCommand(oPC,DelayCommand(1.0,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(oSelf,"iAmInUse")!=0)
|
||||
{
|
||||
FloatingTextStringOnCreature("Only one bolt of cloth may be dyed at a time.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
int iClothType = GetLocalInt(oPC,"iUseThisCloth");
|
||||
string sClothTag = "ITEM_CLOTH_NORMAL";
|
||||
if (iClothType==1) sClothTag = "ITEM_CLOTH_WOOL";
|
||||
if (iClothType==2) sClothTag = "ITEM_CLOTH_SILK";
|
||||
if (iClothType>2) iClothType=0;
|
||||
if (iClothType<0) iClothType = 0;
|
||||
|
||||
object oCloth = GetItemPossessedBy(oPC,sClothTag);
|
||||
|
||||
if (oCloth == OBJECT_INVALID)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have the selected cloth type to work with..",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
int iDye = 0;
|
||||
|
||||
if (sItemTag=="DYE_AQUA") iDye = 1;
|
||||
if (sItemTag=="DYE_BLACK") iDye = 2;
|
||||
if (sItemTag=="DYE_BLUE") iDye = 3;
|
||||
if (sItemTag=="DYE_YELLOW") iDye = 4;
|
||||
if (sItemTag=="DYE_GREEN") iDye = 5;
|
||||
if (sItemTag=="DYE_BROWN") iDye = 6;
|
||||
if (sItemTag=="DYE_GOLD") iDye = 7;
|
||||
if (sItemTag=="DYE_BRONZE") iDye = 8;
|
||||
if (sItemTag=="DYE_SILVER") iDye = 9;
|
||||
if (sItemTag=="DYE_GREY") iDye = 10;
|
||||
if (sItemTag=="DYE_PINK") iDye = 11;
|
||||
if (sItemTag=="DYE_ORANGE") iDye = 12;
|
||||
if (sItemTag=="DYE_TAN") iDye = 13;
|
||||
if (sItemTag=="DYE_COPPER") iDye = 14;
|
||||
if (sItemTag=="DYE_WHITE") iDye = 15;
|
||||
if (sItemTag=="DYE_PLATINUM") iDye = 16;
|
||||
if (sItemTag=="DYE_PURPLE") iDye = 17;
|
||||
if (sItemTag=="DYE_CHARCOAL") iDye = 18;
|
||||
if (sItemTag=="DYE_MINTGREEN") iDye = 19;
|
||||
if (sItemTag=="DYE_DARKRED") iDye = 20;
|
||||
if (sItemTag=="DYE_DARKGREEN") iDye = 21;
|
||||
if (sItemTag=="DYE_DARKBLUE") iDye = 22;
|
||||
if (sItemTag=="DYE_PEACH") iDye = 23;
|
||||
if (sItemTag=="DYE_SMOKE") iDye = 24;
|
||||
if (sItemTag=="DYE_FUSCHIA") iDye = 25;
|
||||
if (sItemTag=="DYE_OLIVE") iDye = 26;
|
||||
if (sItemTag=="DYE_YELLOWGREEN") iDye = 27;
|
||||
if (sItemTag=="DYE_YELLOWGRN") iDye = 27;
|
||||
if (sItemTag=="DYE_RUST") iDye = 28;
|
||||
if (sItemTag=="DYE_CHROMATIC") iDye = 29;
|
||||
if (sItemTag=="DYE_METALLIC") iDye = 30;
|
||||
|
||||
if (iDye==0)
|
||||
{
|
||||
FloatingTextStringOnCreature("This item is not useable in this tub..",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
string sDyeResRef = "dye0";
|
||||
if (iDye<10) sDyeResRef = sDyeResRef+"0"+IntToString(iDye);
|
||||
if (iDye>9) sDyeResRef = sDyeResRef+IntToString(iDye);
|
||||
|
||||
//int iDyeSkill = GetTokenPair(oPC,13,12); //Cloth Dyeing Skill
|
||||
|
||||
//nwn database
|
||||
//int iDyeSkill = GetCampaignInt("UOACraft","iDyeSkill",oPC);
|
||||
|
||||
//external database
|
||||
int iDyeSkill = GetPersistentInt(oPC,"iDyeSkill","UOACraft");
|
||||
|
||||
int iDyeChance = iDyeSkill;
|
||||
if (iDyeChance < 350)
|
||||
{
|
||||
iDyeChance = GetAbilityScore(oPC,ABILITY_WISDOM)*5;
|
||||
iDyeChance = iDyeChance+(GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*3);
|
||||
iDyeChance = iDyeChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*2);
|
||||
iDyeChance = iDyeChance*3;
|
||||
if (iDyeChance>350)iDyeChance=350;
|
||||
if (iDyeSkill > iDyeChance) iDyeChance=iDyeSkill;
|
||||
}
|
||||
|
||||
// Determine Cloth-dyeing difficulty based on type of cloth and color value
|
||||
int iPenalty = iDye*10;
|
||||
iPenalty = iPenalty + (iClothType*200);
|
||||
iDyeChance = iDyeChance - iPenalty;
|
||||
if (iDyeChance <1)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have the skill in cloth dyeing to dye this cloth in the selected color..",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Ensure correct stack information for dyes is gathered, and set stack to be less by 1.
|
||||
object oDye = GetItemPossessedBy(oSelf,sItemTag);
|
||||
int iDyeStack = GetNumStackedItems(oDye)-1;
|
||||
DestroyObject(oDye);
|
||||
|
||||
string sItemResRef = "dyed_cloth0";
|
||||
if (iClothType==1) sItemResRef=sItemResRef+IntToString(iDye+30);
|
||||
if (iClothType==2) sItemResRef=sItemResRef+IntToString(iDye+60);
|
||||
if (iClothType==0)
|
||||
{
|
||||
if (iDye >9)sItemResRef=sItemResRef+IntToString(iDye);
|
||||
if (iDye<10)sItemResRef=sItemResRef+"0"+IntToString(iDye);
|
||||
}
|
||||
|
||||
DelayCommand(0.5,DestroyObject(oCloth));
|
||||
|
||||
// Do skill check for success/fail
|
||||
int iSkillGain = 0;
|
||||
string sSuccess = "You have successfully dyed the cloth.";
|
||||
string sFail = "The cloth fails to absorb the dye evenly, resulting in ruined cloth.";
|
||||
string sFailResRef = "boltofcloth004";
|
||||
if (iClothType==1) sFailResRef = "boltofcloth005";
|
||||
if (iClothType==2) sFailResRef = "boltofcloth006";
|
||||
|
||||
DelayCommand(1.0,CreateAnObject(sDyeResRef,oPC,iDyeStack));
|
||||
if (Random(1000) <= iDyeChance)
|
||||
{
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
||||
DelayCommand(6.0,CreateAnObject(sItemResRef,oPC,1));
|
||||
if (Random(1000) >= iDyeSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iDyeChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature(sFail,oPC,FALSE));
|
||||
DelayCommand(6.0,CreateAnObject(sFailResRef,oPC,1));
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
// Do Skill Gains
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
if (iSkillGain==1)
|
||||
{
|
||||
iDyeSkill++;
|
||||
sOldSkill2 = IntToString(iDyeSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iDyeSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iDyeSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(13.0,SetTokenPair(oPC,13,12,iDyeSkill));
|
||||
|
||||
//nwn database
|
||||
//DelayCommand(13.0,SetCampaignInt("UOACraft","iDyeSkill",iDyeSkill,oPC));
|
||||
|
||||
//external database
|
||||
DelayCommand(13.0,SetPersistentInt(oPC,"iDyeSkill",iDyeSkill,0,"UOACraft"));
|
||||
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"======================================="));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in cloth dyeing has gone up!"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"Current cloth dyeing skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"======================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
SetLocalInt(oSelf,"iAmInUse",99);
|
||||
DelayCommand(7.0,SetLocalInt(oSelf,"iAmInUse",0));
|
||||
|
||||
// Assign sounds and animations
|
||||
PlaySound("as_na_waterlap1");
|
||||
AssignCommand(oPC,PlaySound("as_na_splash2"));
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,6.0));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
477
_module/nss/_craft_fishing.nss
Normal file
477
_module/nss/_craft_fishing.nss
Normal file
@@ -0,0 +1,477 @@
|
||||
//#include "_persist_01a"
|
||||
|
||||
void CreatePlaceable(object oPC, string sObject, location lPlace, float fDuration);
|
||||
void CreateAMonster(string sMonster, object oPC, int iNumberOfMonsters);
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void CancelFishing(object oPC, location lCurrent);
|
||||
void DelayText(object oPC, string sMessage);
|
||||
void DelaySkill(object oPC, int iFishingSkill, string sOldSkill);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
int iFishingSkill = 0;
|
||||
int iFishingChance = 0;
|
||||
object oPC = OBJECT_SELF;
|
||||
if (GetResRef(oPC) == "fishinghole") oPC = GetClickingObject();
|
||||
|
||||
if (GetLocalInt(oPC,"iAmFishing") != 0) return;
|
||||
if (GetLocalInt(oPC,"iCancelFishing") != 0)
|
||||
{
|
||||
SetLocalInt(oPC,"iCancelFishing",0);
|
||||
return;
|
||||
}
|
||||
object oPole = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
|
||||
string sPoleTag = "ITEM_FISHINGPOLE";
|
||||
|
||||
if (GetRacialType(oPC) == RACIAL_TYPE_HALFLING) sPoleTag = "ITEM_FISHINGROD";
|
||||
if (GetRacialType(oPC) == RACIAL_TYPE_GNOME) sPoleTag = "ITEM_FISHINGROD";
|
||||
if (GetRacialType(oPC) == RACIAL_TYPE_DWARF) sPoleTag = "ITEM_FISHINGROD";
|
||||
if (GetStringLeft(GetTag(oPole),16) != sPoleTag)
|
||||
{
|
||||
oPole = GetItemPossessedBy(oPC,sPoleTag);
|
||||
if (oPole == OBJECT_INVALID)
|
||||
{
|
||||
if (sPoleTag =="ITEM_FISHINGPOLE")
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have a fishing pole in order to catch fish",oPC,FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have a fishing rod in order to catch fish",oPC,FALSE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
AssignCommand(oPC,ActionEquipItem(oPole,INVENTORY_SLOT_RIGHTHAND));
|
||||
}
|
||||
SetLocalInt(oPC,"iAmFishing",99);
|
||||
AssignCommand(oPC,DelayCommand(12.0,SetLocalInt(oPC,"iAmFishing",0)));
|
||||
DelayCommand(1.0,FloatingTextStringOnCreature("You cast your pole into the water...",oPC,FALSE));
|
||||
SetLocalLocation(oPC,"lIWasHere",GetLocation(oPC));
|
||||
AssignCommand(oPC,DelayCommand(13.0,CancelFishing(oPC,GetLocation(OBJECT_SELF))));
|
||||
AssignCommand(oPC,DelayCommand(1.0,ActionPlayAnimation(ANIMATION_FIREFORGET_SALUTE,1.0,1.0)));
|
||||
AssignCommand(oPC,DelayCommand(4.0,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,6.0)));
|
||||
AssignCommand(oPC,DelayCommand(10.0,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,2.0)));
|
||||
switch (Random(3))
|
||||
{
|
||||
case 1:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip4")));break;}
|
||||
case 2:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip5")));break;}
|
||||
default:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip4")));break;}
|
||||
}
|
||||
|
||||
//iFishingSkill = GetTokenPair(oPC,14,13);
|
||||
iFishingSkill = GetCampaignInt("UOACraft","iFishingSkill",oPC);
|
||||
iFishingChance = iFishingSkill;
|
||||
if (iFishingChance <350)
|
||||
{
|
||||
iFishingChance = GetAbilityScore(oPC,ABILITY_CHARISMA)*5;
|
||||
iFishingChance = iFishingChance+(GetAbilityScore(oPC,ABILITY_STRENGTH)*3);
|
||||
iFishingChance = iFishingChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*2);
|
||||
iFishingChance = iFishingChance*3;
|
||||
if (iFishingChance >350) iFishingChance = 350;
|
||||
if (iFishingSkill > iFishingChance) iFishingChance = iFishingSkill;
|
||||
}
|
||||
|
||||
int iFishRange = 7;
|
||||
if (iFishingChance > 250) iFishRange++; //smallmouth
|
||||
if (iFishingChance > 350) iFishRange++; // largemouth
|
||||
if (iFishingChance > 450) iFishRange++; // trout
|
||||
if (iFishingChance > 500) iFishRange++; // small channel cat
|
||||
if (iFishingChance > 550) iFishRange++; // small channel cat
|
||||
if (iFishingChance > 600) iFishRange++; // medium
|
||||
if (iFishingChance > 650) iFishRange++; // medium
|
||||
if (iFishingChance > 700) iFishRange++; // large
|
||||
if (iFishingChance > 750) iFishRange++; // very large
|
||||
|
||||
int iRandom = Random(1000);
|
||||
int iSuccess = 0;
|
||||
int iSkillGain = 0;
|
||||
string sFishResRef = "";
|
||||
string sSuccessMessage = "";
|
||||
string sFailMessage = "You fish for a while but fail to catch anything...";
|
||||
|
||||
if (iRandom <= iFishingChance)
|
||||
{
|
||||
iSuccess = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,DelayText(oPC,sFailMessage)));
|
||||
}
|
||||
|
||||
if (iSuccess == 1)
|
||||
{
|
||||
if (Random(1000)<500)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,PlaySound("as_na_splash1")));
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,PlaySound("as_na_splash2")));
|
||||
}
|
||||
iRandom = Random(1000);
|
||||
if (iRandom >= iFishingSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iFishingChance/100) iSkillGain = 1;
|
||||
}
|
||||
int iFishNormalFlag = 0;
|
||||
iRandom = Random(iFishRange);
|
||||
|
||||
switch (iRandom)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
sFishResRef = "fish002";
|
||||
sSuccessMessage = "You pitifully manage to catch a freshwater guppy...";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
sFishResRef = "fish003";
|
||||
sSuccessMessage = "You pitifully manage to catch a freshwater tadpole...";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
sFishResRef = "fish004";
|
||||
sSuccessMessage = "You manage to catch a freshwater bullfrog.";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
sFishResRef = "fish005";
|
||||
sSuccessMessage = "You manage to catch a freshwater bluegill.";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
sFishResRef = "fish006";
|
||||
sSuccessMessage = "You manage to catch a freshwater crappie.";
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
sFishResRef = "fish007";
|
||||
sSuccessMessage = "You manage to catch a freshwater carp.";
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
sFishResRef = "fish008";
|
||||
sSuccessMessage = "You manage to catch a freshwater smallmouth bass.";
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
sFishResRef = "fish009";
|
||||
sSuccessMessage = "You manage to catch a freshwater largemouth bass.";
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
sFishResRef = "fish010";
|
||||
sSuccessMessage = "You manage to catch a freshwater rainbow trout.";
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
sFishResRef = "fish011";
|
||||
sSuccessMessage = "You manage to catch a very small channel catfish.";
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
sFishResRef = "fish012";
|
||||
sSuccessMessage = "You manage to catch a small channel catfish.";
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
sFishResRef = "fish013";
|
||||
sSuccessMessage = "You manage to catch a medium channel catfish.";
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
sFishResRef = "fish014";
|
||||
sSuccessMessage = "You manage to catch a somewhat large channel catfish.";
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
sFishResRef = "fish015";
|
||||
sSuccessMessage = "You manage to catch a rather large channel catfish.";
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
{
|
||||
sFishResRef = "fish016";
|
||||
sSuccessMessage = "You manage to catch an extremely large channel catfish.";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
sFishResRef = "fish001";
|
||||
sSuccessMessage = "You jokingly manage to catch a freshwater minnow.";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Assign a 1 in 20 chance of a non-fish retrieval
|
||||
if (d20(1) == 10)
|
||||
{
|
||||
iFishNormalFlag = Random(6);
|
||||
switch (iFishNormalFlag)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
sFishResRef = "junk001";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You fish for a while and manage to catch an old human skull.";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
sFishResRef = "junk001";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You fish for a while and manage to catch a bundle of oily rags.";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
sFishResRef = "junk001";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You fish for a while and manage to catch a waterlogged corpse.";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,PlaySound("al_an_bugs1")));
|
||||
sFishResRef = "btlstink003"; // lesser water beetle
|
||||
if (GetHitDice(oPC) > 6) sFishResRef = "btlstink002"; // water beetle
|
||||
if (GetHitDice(oPC) > 9) sFishResRef = "btlstink001"; // greater water beetle
|
||||
if (Random(1000)<300) sFishResRef = "btlstink003";
|
||||
if (Random(1000)<100) sFishResRef = "btlstink002";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAMonster(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You have disturbed a water beetle!";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,PlaySound("al_an_bugs1")));
|
||||
sFishResRef = "spidgiant003"; // small water spider
|
||||
if (GetHitDice(oPC) > 6) sFishResRef = "spidgiant004"; // water spider
|
||||
if (GetHitDice(oPC) > 9) sFishResRef = "spidgiant005"; // large water spider
|
||||
if (Random(1000)<300) sFishResRef = "spidgiant003";
|
||||
if (Random(1000)<100) sFishResRef = "spidgiant004";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAMonster(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You have disturbed a water spider!";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.5,(CreatePlaceable(oPC, "waterloggedcorps",GetLocation(oPC),600.0))));
|
||||
sSuccessMessage = "You have pulled a water-soaked corpse fromt he water!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
AssignCommand(oPC,DelayCommand(11.0,DelayText(oPC,sSuccessMessage)));
|
||||
if (iFishNormalFlag == 0)
|
||||
{
|
||||
//chance of fishing up map
|
||||
if (iFishingChance>800)
|
||||
{
|
||||
if (Random(1000)>950)
|
||||
{
|
||||
if (Random(1000)>990) iFishNormalFlag++;
|
||||
if (iFishingChance>900)
|
||||
{
|
||||
if (Random(1000)>990) iFishNormalFlag++;
|
||||
}
|
||||
if (iFishingChance>999)
|
||||
{
|
||||
if (Random(1000)>990) iFishNormalFlag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iFishNormalFlag==0)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
string sTempResRef;
|
||||
if (iFishNormalFlag==1) sTempResRef="_undecoded_tmap1";
|
||||
if (iFishNormalFlag==2) sTempResRef="_undecoded_tmap2";
|
||||
if (iFishNormalFlag==3) sTempResRef="_undecoded_tmap3";
|
||||
|
||||
AssignCommand(oPC,DelayCommand(11.1,DelayText(oPC,sSuccessMessage)));
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(11.9,CreateAnObject(sTempResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.1,DelayText(oPC,"You also pull out a waterlogged piece of old parchment!")));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Begin freshwater fish descriptors
|
||||
// fish001 - minnow
|
||||
// fish002 - guppy
|
||||
// fish003 - tadpole
|
||||
// fish004 - bullfrog
|
||||
// fish005 - bluegill
|
||||
// fish006 - crappie
|
||||
// fish007 - carp
|
||||
// fish008 - smallmouth bass
|
||||
// fish009 - largemouth bass
|
||||
// fish010 - rainbow trout
|
||||
// fish011 - Small channel catfish
|
||||
// fish012 - small channel catfish
|
||||
// fish013 - Medium Channel Catfish
|
||||
// fish014 - Medium Channel Catfish
|
||||
// fish015 - Large channel catfish
|
||||
// fish016 - Very Large Channel Catfish
|
||||
|
||||
// ---------------begin saltwater fish descriptors
|
||||
// fish017 - Cod
|
||||
// fish018 - Flounder
|
||||
// fish019 - shad
|
||||
// fish020 - Sea Bass
|
||||
// fish021 - Black Sea Bass
|
||||
// fish022 - mackerel
|
||||
// fish023 - blue fish
|
||||
// fish024 - fluke
|
||||
// fish025 - striped bass
|
||||
// fish026 - white marlin
|
||||
// fish027 - Blue shark
|
||||
// fish028 - yellowfin tuna
|
||||
// fish029 - mako shark
|
||||
// fish030 - swordfish
|
||||
// fish031 - bluefin tuna
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iFishingSkill++;
|
||||
sOldSkill2 = IntToString(iFishingSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iFishingSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iFishingSkill <= 1000)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(12.0,DelaySkill(oPC,iFishingSkill, sOldSkill)));
|
||||
//DelayCommand(12.0,SetTokenPair(oPC,14,13,iFishingSkill));
|
||||
//DelayCommand(12.0,SendMessageToPC(oPC,"=================================="));
|
||||
//DelayCommand(12.0,SendMessageToPC(oPC,"Your skill in fishing has gone up!"));
|
||||
//DelayCommand(12.0,SendMessageToPC(oPC,"Current fishing skill : "+ sOldSkill+"%"));
|
||||
//DelayCommand(12.0,SendMessageToPC(oPC,"=================================="));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))<0.9)
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void CreateAMonster(string sMonster, object oPC, int iNumberOfMonsters)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
||||
object oTemp = OBJECT_INVALID;
|
||||
location lSelf = GetLocation(oPC);
|
||||
vector vSelf = GetPosition(oPC);
|
||||
object oArea = GetArea(oPC);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
float fSelf;
|
||||
int iRandom;
|
||||
float fDistance;
|
||||
location lFire;
|
||||
|
||||
for (iNumberOfMonsters; iNumberOfMonsters>0; iNumberOfMonsters--)
|
||||
{
|
||||
SendMessageToPC(oPC,"Oops! You disturbed a Monster!!");
|
||||
fSelf = GetFacing(oPC)+Random(360);
|
||||
|
||||
fDistance = (IntToFloat(Random(100)+1)/10.0);
|
||||
vFire = vSelf + (AngleToVector(fSelf) * fDistance);
|
||||
lFire = Location(oArea,vFire,fSelf);
|
||||
oTemp = CreateObject(OBJECT_TYPE_CREATURE,sMonster,lFire,FALSE);
|
||||
AssignCommand(oTemp,SetFacingPoint(AngleToVector(GetFacing(oPC))));
|
||||
AssignCommand(oTemp, ActionAttack(oPC,FALSE));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void CancelFishing(object oPC, location lCurrent)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.4)
|
||||
{
|
||||
SetLocalInt(oPC,"iCancelFishing",99);
|
||||
}
|
||||
if (GetIsDead(oPC)==TRUE) SetLocalInt(oPC,"iCancelFishing",99);
|
||||
if (GetArea(oPC)!=GetAreaFromLocation(GetLocalLocation(oPC,"lIWasHere"))) SetLocalInt(oPC,"iCancelFishing",99);
|
||||
AssignCommand(oPC,ExecuteScript("_craft_fishing",oPC));
|
||||
return;
|
||||
}
|
||||
|
||||
void CreatePlaceable(object oPC, string sObject, location lPlace, float fDuration)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
||||
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
||||
if (fDuration != 0.0)
|
||||
DestroyObject(oPlaceable,fDuration);
|
||||
return ;
|
||||
}
|
||||
|
||||
void DelayText(object oPC, string sMessage)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
||||
FloatingTextStringOnCreature(sMessage,oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
void DelaySkill(object oPC, int iFishingSkill, string sOldSkill)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
||||
//SetTokenPair(oPC,14,13,iFishingSkill);
|
||||
SetCampaignInt("UOACraft","iFishingSkill",iFishingSkill,oPC);
|
||||
SendMessageToPC(oPC,"==================================");
|
||||
SendMessageToPC(oPC,"Your skill in fishing has gone up!");
|
||||
SendMessageToPC(oPC,"Current fishing skill : "+ sOldSkill+"%");
|
||||
SendMessageToPC(oPC,"==================================");
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP"));
|
||||
return;
|
||||
}
|
483
_module/nss/_craft_fishing2.nss
Normal file
483
_module/nss/_craft_fishing2.nss
Normal file
@@ -0,0 +1,483 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
|
||||
void CreatePlaceable(object oPC, string sObject, location lPlace, float fDuration);
|
||||
void CreateAMonster(string sMonster, object oPC, int iNumberOfMonsters);
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void CancelFishing(object oPC, location lCurrent);
|
||||
void DelayText(object oPC, string sMessage);
|
||||
void DelaySkill(object oPC, int iFishingSkill, string sOldSkill);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
int iFishingSkill = 0;
|
||||
int iFishingChance = 0;
|
||||
object oPC = OBJECT_SELF;
|
||||
if (GetResRef(oPC) == "fishinghole001") oPC = GetClickingObject();
|
||||
|
||||
if (GetLocalInt(oPC,"iAmFishing") != 0) return;
|
||||
if (GetLocalInt(oPC,"iCancelFishing") != 0)
|
||||
{
|
||||
SetLocalInt(oPC,"iCancelFishing",0);
|
||||
return;
|
||||
}
|
||||
object oPole = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
|
||||
string sPoleTag = "ITEM_FISHINGPOLE";
|
||||
|
||||
if (GetRacialType(oPC) == RACIAL_TYPE_HALFLING) sPoleTag = "ITEM_FISHINGROD";
|
||||
if (GetRacialType(oPC) == RACIAL_TYPE_GNOME) sPoleTag = "ITEM_FISHINGROD";
|
||||
if (GetRacialType(oPC) == RACIAL_TYPE_DWARF) sPoleTag = "ITEM_FISHINGROD";
|
||||
if (GetStringLeft(GetTag(oPole),16) != sPoleTag)
|
||||
{
|
||||
oPole = GetItemPossessedBy(oPC,sPoleTag);
|
||||
if (oPole == OBJECT_INVALID)
|
||||
{
|
||||
if (sPoleTag =="ITEM_FISHINGPOLE")
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have a fishing pole in order to catch fish",oPC,FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have a fishing rod in order to catch fish",oPC,FALSE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
AssignCommand(oPC,ActionEquipItem(oPole,INVENTORY_SLOT_RIGHTHAND));
|
||||
}
|
||||
SetLocalInt(oPC,"iAmFishing",99);
|
||||
AssignCommand(oPC,DelayCommand(12.0,SetLocalInt(oPC,"iAmFishing",0)));
|
||||
DelayCommand(1.0,FloatingTextStringOnCreature("You cast your pole into the water...",oPC,FALSE));
|
||||
SetLocalLocation(oPC,"lIWasHere",GetLocation(oPC));
|
||||
AssignCommand(oPC,DelayCommand(13.0,CancelFishing(oPC,GetLocation(OBJECT_SELF))));
|
||||
AssignCommand(oPC,DelayCommand(1.0,ActionPlayAnimation(ANIMATION_FIREFORGET_SALUTE,1.0,1.0)));
|
||||
AssignCommand(oPC,DelayCommand(4.0,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,6.0)));
|
||||
AssignCommand(oPC,DelayCommand(10.0,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,2.0)));
|
||||
switch (Random(3))
|
||||
{
|
||||
case 1:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip4")));break;}
|
||||
case 2:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip5")));break;}
|
||||
default:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip4")));break;}
|
||||
}
|
||||
|
||||
//iFishingSkill = GetTokenPair(oPC,14,13);
|
||||
//iFishingSkill = GetCampaignInt("UOACraft","iFishingSkill",oPC);
|
||||
iFishingSkill = GetPersistentInt(oPC,"iFishingSkill","UOACraft");
|
||||
iFishingChance = iFishingSkill;
|
||||
if (iFishingChance <350)
|
||||
{
|
||||
iFishingChance = GetAbilityScore(oPC,ABILITY_CHARISMA)*5;
|
||||
iFishingChance = iFishingChance+(GetAbilityScore(oPC,ABILITY_STRENGTH)*3);
|
||||
iFishingChance = iFishingChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*2);
|
||||
iFishingChance = iFishingChance*3;
|
||||
if (iFishingChance >350) iFishingChance = 350;
|
||||
if (iFishingSkill > iFishingChance) iFishingChance = iFishingSkill;
|
||||
}
|
||||
|
||||
int iFishRange = 6;
|
||||
if (iFishingChance > 500) iFishRange++; // Bluefish
|
||||
if (iFishingChance > 550) iFishRange++; // Fluke
|
||||
if (iFishingChance > 600) iFishRange++; // Striped Bass
|
||||
if (iFishingChance > 650) iFishRange++; // White Marlin
|
||||
if (iFishingChance > 700) iFishRange++; // Blue Shark
|
||||
if (iFishingChance > 750) iFishRange++; // Yellowfin Tuna
|
||||
if (iFishingChance > 800) iFishRange++; // Mako Shark
|
||||
if (iFishingChance > 850) iFishRange++; // Swordfish
|
||||
if (iFishingChance > 900) iFishRange++; // Bluefin Tuna
|
||||
|
||||
int iRandom = Random(1000);
|
||||
int iSuccess = 0;
|
||||
int iSkillGain = 0;
|
||||
string sFishResRef = "";
|
||||
string sSuccessMessage = "";
|
||||
string sFailMessage = "You fish for a while but fail to catch anything.";
|
||||
|
||||
if (iRandom <= iFishingChance)
|
||||
{
|
||||
iSuccess = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,DelayText(oPC,sFailMessage)));
|
||||
}
|
||||
|
||||
if (iSuccess == 1)
|
||||
{
|
||||
if (Random(1000)<500)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,PlaySound("as_na_splash1")));
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,PlaySound("as_na_splash2")));
|
||||
}
|
||||
iRandom = Random(1000);
|
||||
if (iRandom >= iFishingSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iFishingChance/100) iSkillGain = 1;
|
||||
}
|
||||
int iFishNormalFlag = 0;
|
||||
iRandom = Random(iFishRange);
|
||||
|
||||
switch (iRandom)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
sFishResRef = "fish018";
|
||||
sSuccessMessage = "You manage to catch a flounder.";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
sFishResRef = "fish019";
|
||||
sSuccessMessage = "You successfully manage to catch a saltwater shad.";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
sFishResRef = "fish020";
|
||||
sSuccessMessage = "You manage to catch a sea bass.";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
sFishResRef = "fish021";
|
||||
sSuccessMessage = "You manage to catch a black sea bass.";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
sFishResRef = "fish022";
|
||||
sSuccessMessage = "You manage to catch a saltwater mackerel.";
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
sFishResRef = "fish023";
|
||||
sSuccessMessage = "You manage to catch a saltwater bluefish.";
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
sFishResRef = "fish024";
|
||||
sSuccessMessage = "You manage to catch a saltwater fluke.";
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
sFishResRef = "fish025";
|
||||
sSuccessMessage = "You manage to catch a saltwater striped bass.";
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
sFishResRef = "fish026";
|
||||
sSuccessMessage = "You manage to catch a white marlin.";
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
sFishResRef = "fish027";
|
||||
sSuccessMessage = "You carefully manage to hook and land a blue shark.";
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
sFishResRef = "fish028";
|
||||
sSuccessMessage = "You manage to catch a yellowfin tuna.";
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
sFishResRef = "fish029";
|
||||
sSuccessMessage = "You carefully manage to hook and land a mako shark.";
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
sFishResRef = "fish030";
|
||||
sSuccessMessage = "You manage to hook and land a swordfish!";
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
sFishResRef = "fish031";
|
||||
sSuccessMessage = "You successfully hook and land a large bluefin tuna!";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
sFishResRef = "fish017";
|
||||
sSuccessMessage = "You successfully catch a saltwater cod.";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Assign a 1 in 20 chance of a non-fish retrieval
|
||||
if (d20(1) == 10)
|
||||
{
|
||||
iFishNormalFlag = Random(6);
|
||||
switch (iFishNormalFlag)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
sFishResRef = "junk001";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You fish for a while and manage to catch an old human skull.";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
sFishResRef = "junk001";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You fish for a while and manage to catch a bundle of oily rags.";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
sFishResRef = "junk001";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You fish for a while and manage to catch a waterlogged corpse.";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,PlaySound("al_an_bugs1")));
|
||||
sFishResRef = "btlstink003"; // lesser water beetle
|
||||
if (GetHitDice(oPC) > 6) sFishResRef = "btlstink002"; // water beetle
|
||||
if (GetHitDice(oPC) > 9) sFishResRef = "btlstink001"; // greater water beetle
|
||||
if (Random(1000)<300) sFishResRef = "btlstink003";
|
||||
if (Random(1000)<100) sFishResRef = "btlstink002";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAMonster(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You have disturbed a water beetle!";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.0,PlaySound("al_an_bugs1")));
|
||||
sFishResRef = "spidgiant003"; // small water spider
|
||||
if (GetHitDice(oPC) > 6) sFishResRef = "spidgiant004"; // water spider
|
||||
if (GetHitDice(oPC) > 9) sFishResRef = "spidgiant005"; // large water spider
|
||||
if (Random(1000)<300) sFishResRef = "spidgiant003";
|
||||
if (Random(1000)<100) sFishResRef = "spidgiant004";
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAMonster(sFishResRef,oPC,1)));
|
||||
sSuccessMessage = "You have disturbed a water spider!";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.5,(CreatePlaceable(oPC, "waterloggedcorps",GetLocation(oPC),600.0))));
|
||||
sSuccessMessage = "You have pulled a heavy water-soaked corpse from the water!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
AssignCommand(oPC,DelayCommand(11.0,DelayText(oPC,sSuccessMessage)));
|
||||
if (iFishNormalFlag == 0)
|
||||
{
|
||||
//chance of fishing up map
|
||||
if (iFishingChance>900) //Minimum skill
|
||||
{
|
||||
if (Random(1000)>950) //1 in 20 chance to have a chance
|
||||
{
|
||||
if (Random(1000)>990) iFishNormalFlag++;
|
||||
if (iFishingChance>925)
|
||||
{
|
||||
if (Random(1000)>990) iFishNormalFlag++;
|
||||
}
|
||||
if (iFishingChance>950)
|
||||
{
|
||||
if (Random(1000)>990) iFishNormalFlag++;
|
||||
}
|
||||
if (iFishingChance>980)
|
||||
{
|
||||
if (Random(1000)>990) iFishNormalFlag++;
|
||||
}
|
||||
if (iFishingChance>999)
|
||||
{
|
||||
if (Random(1000)>990) iFishNormalFlag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iFishNormalFlag==0)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
string sTempResRef;
|
||||
if (iFishNormalFlag==1) sTempResRef="_undecoded_tmap1";
|
||||
if (iFishNormalFlag==2) sTempResRef="_undecoded_tmap2";
|
||||
if (iFishNormalFlag==3) sTempResRef="_undecoded_tmap3";
|
||||
if (iFishNormalFlag==3) sTempResRef="_undecoded_tmap4";
|
||||
if (iFishNormalFlag==3) sTempResRef="_undecoded_tmap5";
|
||||
|
||||
AssignCommand(oPC,DelayCommand(11.1,DelayText(oPC,sSuccessMessage)));
|
||||
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(11.9,CreateAnObject(sTempResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.1,DelayText(oPC,"You also pull out a saltwater-encrusted piece of old parchment!")));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Begin freshwater fish descriptors
|
||||
// fish001 - minnow
|
||||
// fish002 - guppy
|
||||
// fish003 - tadpole
|
||||
// fish004 - bullfrog
|
||||
// fish005 - bluegill
|
||||
// fish006 - crappie
|
||||
// fish007 - carp
|
||||
// fish008 - smallmouth bass
|
||||
// fish009 - largemouth bass
|
||||
// fish010 - rainbow trout
|
||||
// fish011 - Small channel catfish
|
||||
// fish012 - small channel catfish
|
||||
// fish013 - Medium Channel Catfish
|
||||
// fish014 - Medium Channel Catfish
|
||||
// fish015 - Large channel catfish
|
||||
// fish016 - Very Large Channel Catfish
|
||||
|
||||
// ---------------begin saltwater fish descriptors
|
||||
// fish017 - Cod
|
||||
// fish018 - Flounder
|
||||
// fish019 - shad
|
||||
// fish020 - Sea Bass
|
||||
// fish021 - Black Sea Bass
|
||||
// fish022 - mackerel
|
||||
// fish023 - blue fish
|
||||
// fish024 - fluke
|
||||
// fish025 - striped bass
|
||||
// fish026 - white marlin
|
||||
// fish027 - Blue shark
|
||||
// fish028 - yellowfin tuna
|
||||
// fish029 - mako shark
|
||||
// fish030 - swordfish
|
||||
// fish031 - bluefin tuna
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iFishingSkill++;
|
||||
sOldSkill2 = IntToString(iFishingSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iFishingSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iFishingSkill <= 1000)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(12.0,DelaySkill(oPC,iFishingSkill, sOldSkill)));
|
||||
//DelayCommand(12.0,SetTokenPair(oPC,14,13,iFishingSkill));
|
||||
//DelayCommand(12.0,SendMessageToPC(oPC,"=================================="));
|
||||
//DelayCommand(12.0,SendMessageToPC(oPC,"Your skill in fishing has gone up!"));
|
||||
//DelayCommand(12.0,SendMessageToPC(oPC,"Current fishing skill : "+ sOldSkill+"%"));
|
||||
//DelayCommand(12.0,SendMessageToPC(oPC,"=================================="));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))<0.9)
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void CreateAMonster(string sMonster, object oPC, int iNumberOfMonsters)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
||||
object oTemp = OBJECT_INVALID;
|
||||
location lSelf = GetLocation(oPC);
|
||||
vector vSelf = GetPosition(oPC);
|
||||
object oArea = GetArea(oPC);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
float fSelf;
|
||||
int iRandom;
|
||||
float fDistance;
|
||||
location lFire;
|
||||
|
||||
for (iNumberOfMonsters; iNumberOfMonsters>0; iNumberOfMonsters--)
|
||||
{
|
||||
SendMessageToPC(oPC,"Oops! You have disturbed something in the water!!");
|
||||
fSelf = GetFacing(oPC)+Random(360);
|
||||
|
||||
fDistance = (IntToFloat(Random(100)+1)/10.0);
|
||||
vFire = vSelf + (AngleToVector(fSelf) * fDistance);
|
||||
lFire = Location(oArea,vFire,fSelf);
|
||||
oTemp = CreateObject(OBJECT_TYPE_CREATURE,sMonster,lFire,FALSE);
|
||||
AssignCommand(oTemp,SetFacingPoint(AngleToVector(GetFacing(oPC))));
|
||||
AssignCommand(oTemp, ActionAttack(oPC,FALSE));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void CancelFishing(object oPC, location lCurrent)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.4)
|
||||
{
|
||||
SetLocalInt(oPC,"iCancelFishing",99);
|
||||
}
|
||||
if (GetIsDead(oPC)==TRUE) SetLocalInt(oPC,"iCancelFishing",99);
|
||||
if (GetArea(oPC)!=GetAreaFromLocation(GetLocalLocation(oPC,"lIWasHere"))) SetLocalInt(oPC,"iCancelFishing",99);
|
||||
AssignCommand(oPC,ExecuteScript("_craft_fishing2",oPC));
|
||||
return;
|
||||
}
|
||||
|
||||
void CreatePlaceable(object oPC, string sObject, location lPlace, float fDuration)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
||||
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
||||
if (fDuration != 0.0)
|
||||
DestroyObject(oPlaceable,fDuration);
|
||||
return ;
|
||||
}
|
||||
|
||||
void DelayText(object oPC, string sMessage)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
||||
FloatingTextStringOnCreature(sMessage,oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
void DelaySkill(object oPC, int iFishingSkill, string sOldSkill)
|
||||
{
|
||||
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
||||
//SetTokenPair(oPC,14,13,iFishingSkill);
|
||||
SetPersistentInt(oPC,"iFishingSkill",iFishingSkill,0,"UOACraft");
|
||||
SendMessageToPC(oPC,"==================================");
|
||||
SendMessageToPC(oPC,"Your skill in fishing has gone up!");
|
||||
SendMessageToPC(oPC,"Current fishing skill : "+ sOldSkill+"%");
|
||||
SendMessageToPC(oPC,"==================================");
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP"));
|
||||
return;
|
||||
}
|
773
_module/nss/_craft_fletching.nss
Normal file
773
_module/nss/_craft_fletching.nss
Normal file
@@ -0,0 +1,773 @@
|
||||
//#include "_persist_01a"
|
||||
#include "nw_i0_plot"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
string CraftLookup(string sResRef, int iIngotType);
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef);
|
||||
int GetModifier(string sItemTag);
|
||||
|
||||
void main()
|
||||
{
|
||||
int iUseMode = 0;
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
iUseMode = 99;
|
||||
if (GetLastDisturbed() == OBJECT_SELF)
|
||||
{
|
||||
DestroyObject(GetInventoryDisturbItem());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
object oTemp = OBJECT_INVALID;
|
||||
|
||||
if (iUseMode == 0)
|
||||
{
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
SendMessageToPC(oPC,"You must wait until the current lathing process is complete before starting another.");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (iUseMode==0)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(13.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
}
|
||||
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sItemTagTemp;
|
||||
string sItem1ResRef = "";
|
||||
string sItem2ResRef = "";
|
||||
string sItem3ResRef = "";
|
||||
string sItemFailResRef = "kindling";
|
||||
string sShaft = "";
|
||||
string sComponentResRef="";
|
||||
string sFeather = "ITEM_FEATHER";
|
||||
int iTemp = 10;
|
||||
int iCount1 = 0;
|
||||
int iCount2 = 0;
|
||||
int iCount3 = 0;
|
||||
int iRandom = 0;
|
||||
int iSuccess = 0;
|
||||
int iQuality = 0;
|
||||
int iShaftType = 0;
|
||||
int iMetalType = 0;
|
||||
int iShaftStackSize = 0;
|
||||
string sSuccess = "";
|
||||
string sTempString = "";
|
||||
int iFletchModifier;
|
||||
int iAttachMode = 0; //If attachmode = 1, do skill check to attach to shafts
|
||||
int iItemStack;
|
||||
int iItemStack2;
|
||||
object oItem2;
|
||||
|
||||
int iFletchingSkill = GetPersistentInt(oPC,"iFletchingSkill","UOACraft");
|
||||
int iFletchingChance = iFletchingSkill;
|
||||
|
||||
if (iFletchingChance <350)
|
||||
{
|
||||
iFletchingChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iFletchingChance = iFletchingChance+(GetAbilityScore(oPC,ABILITY_STRENGTH)*3);
|
||||
iFletchingChance = iFletchingChance+(GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
|
||||
iFletchingChance = iFletchingChance*3;
|
||||
if (iFletchingChance >350) iFletchingChance = 350;
|
||||
if (iFletchingSkill>iFletchingChance)iFletchingChance = iFletchingSkill;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (GetStringLeft(sItemTag,5) != "WOOD_")
|
||||
{
|
||||
if (iUseMode==0)
|
||||
{
|
||||
oItem2 = GetItemPossessedBy(OBJECT_SELF,GetTag(oItem)); //This ensures accurate count of a split stack
|
||||
iItemStack = GetNumStackedItems(oItem2);
|
||||
//SendMessageToPC(oPC,"A) ITEM STACKSIZE - "+IntToString(iItemStack));
|
||||
if (iItemStack==0)
|
||||
{
|
||||
SendMessageToPC(oPC,"An error has occured in trying to determine the number of stacked items placed into the lathe.");
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//SendMessageToPC(oPC," 1) ITEM STACKSIZE - "+IntToString(iItemStack));
|
||||
if (GetStringLeft(sItemTag,5) == "ITEM_")
|
||||
{
|
||||
sTempString = GetStringRight(sItemTag,GetStringLength(sItemTag)-5);
|
||||
if (GetStringLeft(sTempString,2) == "N_")
|
||||
{
|
||||
iQuality = 2;
|
||||
sTempString = GetStringRight(sTempString,GetStringLength(sTempString)-2);
|
||||
}
|
||||
if (GetStringLeft(sTempString,3) == "EX_")
|
||||
{
|
||||
iQuality = 3;
|
||||
sTempString = GetStringRight(sTempString,GetStringLength(sTempString)-3);
|
||||
}
|
||||
if (GetStringLeft(sTempString,5) == "POOR_")
|
||||
{
|
||||
iQuality = 1;
|
||||
sTempString = GetStringRight(sTempString,GetStringLength(sTempString)-5);
|
||||
}
|
||||
}
|
||||
if (GetStringLeft(sTempString,10)== "ARROWHEAD_") iShaftType = 1;
|
||||
if (GetStringLeft(sTempString,8)== "BOLTTIP_") iShaftType = 2;
|
||||
|
||||
|
||||
|
||||
// For filled glass arrowheads
|
||||
if (iQuality==0)
|
||||
{
|
||||
//Determine Quality
|
||||
if (GetStringRight(sItemTag,5)=="_POOR")iQuality = 1;
|
||||
if (GetStringRight(sItemTag,7)=="_NORMAL")iQuality=2;
|
||||
if (GetStringRight(sItemTag,12)=="_EXCEPTIONAL")iQuality=3;
|
||||
|
||||
//Determine Type Arrowheads
|
||||
if (GetStringLeft(sItemTag,16)=="WACID_ARROWHEAD_")iShaftType=1;
|
||||
if (GetStringLeft(sItemTag,16)=="MACID_ARROWHEAD_") iShaftType=1;
|
||||
if (GetStringLeft(sItemTag,16)=="SACID_ARROWHEAD_") iShaftType=1;
|
||||
if (GetStringLeft(sItemTag,17)=="VSACID_ARROWHEAD_") iShaftType=1;
|
||||
|
||||
//Determine Type bolt tips
|
||||
if (GetStringLeft(sItemTag,14)=="WACID_BOLTTIP_") iShaftType=2;
|
||||
if (GetStringLeft(sItemTag,14)=="MACID_BOLTTIP_") iShaftType=2;
|
||||
if (GetStringLeft(sItemTag,14)=="SACID_BOLTTIP_") iShaftType=2;
|
||||
if (GetStringLeft(sItemTag,14)=="VSACID_BOLTTIP_") iShaftType=2;
|
||||
|
||||
//Determine End Product Type
|
||||
if (GetStringLeft(sItemTag,6)=="WACID_")
|
||||
{
|
||||
iMetalType =14;
|
||||
iFletchModifier = 200;
|
||||
iAttachMode=99;
|
||||
}
|
||||
if (GetStringLeft(sItemTag,6)=="MACID_")
|
||||
{
|
||||
iMetalType =15;
|
||||
iFletchModifier = 400;
|
||||
iAttachMode=99;
|
||||
}
|
||||
if (GetStringLeft(sItemTag,6)=="SACID_")
|
||||
{
|
||||
iMetalType =16;
|
||||
iFletchModifier = 600;
|
||||
iAttachMode=99;
|
||||
}
|
||||
if (GetStringLeft(sItemTag,7)=="VSACID_")
|
||||
{
|
||||
iMetalType =17;
|
||||
iFletchModifier = 800;
|
||||
iAttachMode=99;
|
||||
}
|
||||
} //End of filled arrow/bolt determination
|
||||
|
||||
|
||||
if (iShaftType==0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
SendMessageToPC(oPC,"You cannot lathe this item into arrow or bolt shafts!");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
if (iFletchModifier>iFletchingSkill)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
SendMessageToPC(oPC,"You have no idea how to properly attach this to the shafts!");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (iShaftType !=0)
|
||||
{
|
||||
if (iMetalType==0)
|
||||
{
|
||||
if (GetStringRight(sItemTag,7)=="_NORMAL")iMetalType =1;
|
||||
if (GetStringRight(sItemTag,5)=="_DULL")iMetalType =2;
|
||||
if (GetStringRight(sItemTag,7)=="_SHADOW")iMetalType =3;
|
||||
if (GetStringRight(sItemTag,7)=="_COPPER")iMetalType =4;
|
||||
if (GetStringRight(sItemTag,7)=="_BRONZE")iMetalType =5;
|
||||
if (GetStringRight(sItemTag,5)=="_GOLD")iMetalType =6;
|
||||
if (GetStringRight(sItemTag,8)=="_AGAPITE")iMetalType =7;
|
||||
if (GetStringRight(sItemTag,7)=="_VERITE")iMetalType =8;
|
||||
if (GetStringRight(sItemTag,9)=="_VALORITE")iMetalType =9;
|
||||
if (GetStringRight(sItemTag,7)=="_SILVER")iMetalType =10;
|
||||
if (GetStringRight(sItemTag,8)=="_MITHRIL")iMetalType =11;
|
||||
if (GetStringRight(sItemTag,11)=="_ADAMANTITE")iMetalType =12;
|
||||
if (GetStringRight(sItemTag,9)=="_PLATINUM")iMetalType =13;
|
||||
if (iMetalType!=0)
|
||||
{
|
||||
iAttachMode=99;
|
||||
oItem2 = GetItemPossessedBy(OBJECT_SELF,GetTag(oItem)); //This ensures accurate count of a split stack
|
||||
iItemStack = GetNumStackedItems(oItem2);
|
||||
//SendMessageToPC(oPC,"2) ITEM STACKSIZE - "+IntToString(iItemStack));
|
||||
}
|
||||
}
|
||||
|
||||
switch (iQuality)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
if (iShaftType==1)
|
||||
{
|
||||
sShaft = "ITEM_ARROWSHAFTNORMAL";
|
||||
sItem2ResRef = CraftLookup("nw_wamar001",iMetalType);
|
||||
}
|
||||
if (sShaft=="")
|
||||
{
|
||||
sShaft = "ITEM_BOLTSHAFTSNORMAL";
|
||||
sItem2ResRef = CraftLookup("nw_wambo001",iMetalType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
if (iShaftType==1)
|
||||
{
|
||||
sShaft = "ITEM_ARROWSHAFTEXCEPTIONAL";
|
||||
sItem3ResRef = CraftLookup("wamar003",iMetalType);
|
||||
}
|
||||
if (sShaft=="")
|
||||
{
|
||||
sShaft = "ITEM_BOLTSHAFTSEXCEPTIONAL";
|
||||
sItem3ResRef = CraftLookup("wambo003",iMetalType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (iShaftType==1)
|
||||
{
|
||||
sShaft = "ITEM_ARROWSHAFTPOOR";
|
||||
sItem1ResRef = CraftLookup("wamar002",iMetalType);
|
||||
}
|
||||
if (sShaft=="")
|
||||
{
|
||||
sShaft = "ITEM_BOLTSHAFTSPOOR";
|
||||
sItem1ResRef = CraftLookup("wambo002",iMetalType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//check for components
|
||||
if (GetNumItems(oPC,sShaft)<iItemStack)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough shafts to make that many.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
if (GetNumItems(oPC,sFeather)==0)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough feathers to fletch them with.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
//remove components
|
||||
oTemp = GetItemPossessedBy(oPC,sShaft);
|
||||
sComponentResRef = GetResRef(oTemp);
|
||||
iShaftStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
|
||||
if (iShaftStackSize < iItemStack)
|
||||
{
|
||||
iItemStack2 = iItemStack - iShaftStackSize;
|
||||
//SendMessageToPC(oPC,"3) ITEM STACKSIZE - "+IntToString(iItemStack));
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,sShaft,iItemStack2,1,sComponentResRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iShaftStackSize > iItemStack)
|
||||
{
|
||||
iShaftStackSize = iShaftStackSize - iItemStack;
|
||||
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iShaftStackSize));
|
||||
}
|
||||
}
|
||||
if (Random(1000)<iItemStack*10)
|
||||
{
|
||||
DelayCommand(9.1,PlaySound("as_na_bushmove2"));
|
||||
oTemp = GetItemPossessedBy(oPC,sFeather);
|
||||
DestroyObject(oTemp,5.0);
|
||||
AssignCommand(oPC,DelayCommand(5.0,FloatingTextStringOnCreature("You have used up a batch of feathers!",oPC,FALSE)));
|
||||
}
|
||||
|
||||
|
||||
if (iAttachMode!=0) //Check successes while attaching arrowheads to shafts
|
||||
{
|
||||
iFletchModifier = iFletchModifier/2;
|
||||
iCount3 = iItemStack;
|
||||
iItemStack = 0;
|
||||
iFletchingChance = iFletchingChance - iFletchModifier;
|
||||
if (iFletchingChance<1) iFletchingChance=1;
|
||||
iCount1 = 0;
|
||||
for (iCount3; iCount3>0; iCount3--)
|
||||
{
|
||||
if (Random(1000)<=iFletchingChance)iItemStack++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Assign Animations
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,10.0));
|
||||
PlaySound("as_na_grassmove2");
|
||||
DelayCommand(3.0,PlaySound("as_na_grassmove2"));
|
||||
DelayCommand(6.0,PlaySound("as_na_bushmove1"));
|
||||
DelayCommand(9.0,PlaySound("as_na_branchsnp2"));
|
||||
if (iShaftType==1) AssignCommand(oPC,DelayCommand(9.5,FloatingTextStringOnCreature("You create "+IntToString(iItemStack)+" arrows.",oPC,FALSE)));
|
||||
if (iShaftType==2) AssignCommand(oPC,DelayCommand(9.5,FloatingTextStringOnCreature("You create "+IntToString(iItemStack)+" bolts.",oPC,FALSE)));
|
||||
//create the product on the PC
|
||||
if (iQuality==1) DelayCommand(10.0,CreateAnObject(sItem1ResRef,oPC,iItemStack));
|
||||
if (iQuality==2) DelayCommand(10.0,CreateAnObject(sItem2ResRef,oPC,iItemStack));
|
||||
if (iQuality==3) DelayCommand(10.0,CreateAnObject(sItem3ResRef,oPC,iItemStack));
|
||||
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
DestroyObject(oItem,3.0);
|
||||
//int iFletchingSkill = GetTokenPair(oPC,13,2);
|
||||
|
||||
|
||||
//Determine modifiers to success
|
||||
if (iMetalType<14) iFletchModifier = GetModifier(sItemTag);
|
||||
if (iFletchingChance < iFletchModifier)
|
||||
{
|
||||
FloatingTextStringOnCreature("You have no idea how to lathe this wood into shafts.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
iFletchModifier = iFletchModifier/2;
|
||||
//iFletchingChance = iFletchingChance+iFletchModifier;
|
||||
|
||||
|
||||
if (iAttachMode==0) //Check successes while crafting shafts
|
||||
{
|
||||
for (iTemp; iTemp>0; iTemp--)
|
||||
{
|
||||
if (Random(800)<= iFletchingChance-iFletchModifier)
|
||||
{
|
||||
iRandom = Random(1000);
|
||||
if (iRandom <= iFletchingChance-500+iFletchModifier) // Check for Exceptional
|
||||
{
|
||||
iCount3++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iRandom <= iFletchingChance-200+iFletchModifier) // Check for normal
|
||||
{
|
||||
iCount2++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iRandom <= iFletchingChance+iFletchModifier) iCount1++; // Check for poor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (GetLocalInt(oPC,"iFletchingMode")==0) //make arrowshafts
|
||||
{
|
||||
sItem1ResRef = "arrowshaft001";
|
||||
sItem2ResRef = "arrowshaft002";
|
||||
sItem3ResRef = "arrowshaft003";
|
||||
sSuccess = "Arrowshafts created - ("+IntToString(iCount1)+" Poor) ("+IntToString(iCount2)+" Normal) ("+IntToString(iCount3)+" Exceptional) and some kindling";
|
||||
}
|
||||
|
||||
if (GetLocalInt(oPC,"iFletchingMode")!=0) //make boltshafts
|
||||
{
|
||||
sItem1ResRef = "boltshafts001";
|
||||
sItem2ResRef = "boltshafts002";
|
||||
sItem3ResRef = "boltshafts003";
|
||||
sSuccess = "Bolt shafts created - ("+IntToString(iCount1)+" Poor) ("+IntToString(iCount2)+" Normal) ("+IntToString(iCount3)+" Exceptional) and some kindling";
|
||||
}
|
||||
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,12.0));
|
||||
|
||||
AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemFailResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItem1ResRef,oPC,iCount1)));
|
||||
AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItem2ResRef,oPC,iCount2)));
|
||||
AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItem3ResRef,oPC,iCount3)));
|
||||
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
PlaySound("al_cv_fanlg1");
|
||||
PlaySound("al_cv_millwheel1");
|
||||
PlaySound("al_mg_pillrlght1");
|
||||
DelayCommand(6.0,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(6.0,PlaySound("al_cv_millwheel1"));
|
||||
DelayCommand(6.0,PlaySound("al_mg_pillrlght1"));
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF,FALSE),OBJECT_SELF,1.0);
|
||||
DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_ORANGE,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(3.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(5.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(7.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(9.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(11.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),OBJECT_SELF,1.0));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF,FALSE),OBJECT_SELF,1.0));
|
||||
|
||||
if (iFletchingSkill <200)
|
||||
{
|
||||
if (iCount1 >0) iSuccess = 1;
|
||||
if (iCount2 >0) iSuccess = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iFletchingSkill<700)
|
||||
{
|
||||
if (iCount2 >0) iSuccess = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iCount3 >0) iSuccess = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int iSkillGain=0;
|
||||
if (iSuccess==1)
|
||||
{
|
||||
if (d10(1)+1 >= iFletchingSkill/100) iSkillGain = 1;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iFletchingSkill++;
|
||||
sOldSkill2 = IntToString(iFletchingSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iFletchingSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iFletchingSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(12.0,SetTokenPair(oPC,13,2,iFletchingSkill));
|
||||
DelayCommand(12.0,SetPersistentInt(oPC,"iFletchingSkill",iFletchingSkill,0,"UOACraft"));
|
||||
DelayCommand(12.0,SendMessageToPC(oPC,"===================================="));
|
||||
DelayCommand(12.0,SendMessageToPC(oPC,"Your skill in fletching has gone up!"));
|
||||
DelayCommand(12.0,SendMessageToPC(oPC,"Current fletching skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(12.0,SendMessageToPC(oPC,"===================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(11.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
} // End of iUseMode = 0 (added to inventory) section
|
||||
|
||||
if (iUseMode == 99)
|
||||
{
|
||||
if (GetTag(oItem) == "SWITCH_ARROWSHAFT")
|
||||
{
|
||||
CreateItemOnObject("flagswitch003",OBJECT_SELF,1);
|
||||
SetLocalInt(oPC,"iFletchingMode",0);
|
||||
FloatingTextStringOnCreature("Switching to 'Arrowshaft' Mode...",oPC,FALSE);
|
||||
}
|
||||
if (GetTag(oItem) == "SWITCH_BOLTSHAFT")
|
||||
{
|
||||
CreateItemOnObject("flagswitch004",OBJECT_SELF,1);
|
||||
SetLocalInt(oPC,"iFletchingMode",99);
|
||||
FloatingTextStringOnCreature("Switching to 'Boltshaft' Mode...",oPC,FALSE);
|
||||
}
|
||||
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
string CraftLookup(string sResRef, int iIngotType)
|
||||
{
|
||||
switch (iIngotType)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
//Dull Copper Arrows
|
||||
if (sResRef =="wamar002") return "wamar005";
|
||||
if (sResRef =="nw_wamar001") return "wamar004";
|
||||
if (sResRef =="wamar003") return "wamar006";
|
||||
//Dull Copper Bolts
|
||||
if (sResRef=="wambo002") return "wambo005";
|
||||
if (sResRef=="nw_wambo001") return "wambo004";
|
||||
if (sResRef=="wambo003") return "wambo006";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
//Shadow Iron Arrows
|
||||
if (sResRef =="wamar002") return "wamar008";
|
||||
if (sResRef =="nw_wamar001") return "wamar007";
|
||||
if (sResRef =="wamar003") return "wamar009";
|
||||
//Shadow Iron Bolts
|
||||
if (sResRef=="wambo002") return "wambo008";
|
||||
if (sResRef=="nw_wambo001") return "wambo007";
|
||||
if (sResRef=="wambo003") return "wambo009";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
//Copper Arrows
|
||||
if (sResRef =="wamar002") return "wamar011";
|
||||
if (sResRef =="nw_wamar001") return "wamar010";
|
||||
if (sResRef =="wamar003") return "wamar012";
|
||||
//Copper Bolts
|
||||
if (sResRef=="wambo002") return "wambo011";
|
||||
if (sResRef=="nw_wambo001") return "wambo010";
|
||||
if (sResRef=="wambo003") return "wambo012";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
//Bronze Arrows
|
||||
if (sResRef =="wamar002") return "wamar014";
|
||||
if (sResRef =="nw_wamar001") return "wamar013";
|
||||
if (sResRef =="wamar003") return "wamar015";
|
||||
//Bronze Bolts
|
||||
if (sResRef=="wambo002") return "wambo014";
|
||||
if (sResRef=="nw_wambo001") return "wambo013";
|
||||
if (sResRef=="wambo003") return "wambo015";
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
//Gold Arrows
|
||||
if (sResRef =="wamar002") return "wamar017";
|
||||
if (sResRef =="nw_wamar001") return "wamar016";
|
||||
if (sResRef =="wamar003") return "wamar018";
|
||||
//Gold Bolts
|
||||
if (sResRef=="wambo002") return "wambo017";
|
||||
if (sResRef=="nw_wambo001") return "wambo016";
|
||||
if (sResRef=="wambo003") return "wambo018";
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
//Agapite Arrows
|
||||
if (sResRef =="wamar002") return "wamar020";
|
||||
if (sResRef =="nw_wamar001") return "wamar019";
|
||||
if (sResRef =="wamar003") return "wamar021";
|
||||
//Agapite Bolts
|
||||
if (sResRef=="wambo002") return "wambo020";
|
||||
if (sResRef=="nw_wambo001") return "wambo019";
|
||||
if (sResRef=="wambo003") return "wambo021";
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
//Verite Arrows
|
||||
if (sResRef =="wamar002") return "wamar023";
|
||||
if (sResRef =="nw_wamar001") return "wamar022";
|
||||
if (sResRef =="wamar003") return "wamar024";
|
||||
//Verite Bolts
|
||||
if (sResRef=="wambo002") return "wambo023";
|
||||
if (sResRef=="nw_wambo001") return "wambo022";
|
||||
if (sResRef=="wambo003") return "wambo024";
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
//Valorite Arrows
|
||||
if (sResRef =="wamar002") return "wamar026";
|
||||
if (sResRef =="nw_wamar001") return "wamar025";
|
||||
if (sResRef =="wamar003") return "wamar027";
|
||||
//Valorite Bolts
|
||||
if (sResRef=="wambo002") return "wambo026";
|
||||
if (sResRef=="nw_wambo001") return "wambo025";
|
||||
if (sResRef=="wambo003") return "wambo027";
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
//Silver Arrows
|
||||
if (sResRef =="wamar002") return "wamar029";
|
||||
if (sResRef =="nw_wamar001") return "wamar028";
|
||||
if (sResRef =="wamar003") return "wamar030";
|
||||
//Silver Bolts
|
||||
if (sResRef=="wambo002") return "wambo029";
|
||||
if (sResRef=="nw_wambo001") return "wambo028";
|
||||
if (sResRef=="wambo003") return "wambo030";
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
//Mithril Arrows
|
||||
if (sResRef =="wamar002") return "wamar032";
|
||||
if (sResRef =="nw_wamar001") return "wamar031";
|
||||
if (sResRef =="wamar003") return "wamar033";
|
||||
//Mithril Bolts
|
||||
if (sResRef=="wambo002") return "wambo032";
|
||||
if (sResRef=="nw_wambo001") return "wambo031";
|
||||
if (sResRef=="wambo003") return "wambo033";
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
//Adamantite Arrows
|
||||
if (sResRef =="wamar002") return "wamar035";
|
||||
if (sResRef =="nw_wamar001") return "wamar034";
|
||||
if (sResRef =="wamar003") return "wamar036";
|
||||
//Adamantite Bolts
|
||||
if (sResRef=="wambo002") return "wambo035";
|
||||
if (sResRef=="nw_wambo001") return "wambo034";
|
||||
if (sResRef=="wambo003") return "wambo036";
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
//Platinum Arrows
|
||||
if (sResRef =="wamar002") return "wamar038";
|
||||
if (sResRef =="nw_wamar001") return "wamar037";
|
||||
if (sResRef =="wamar003") return "wamar039";
|
||||
//Platinum Bolts
|
||||
if (sResRef=="wambo002") return "wambo038";
|
||||
if (sResRef=="nw_wambo001") return "wambo037";
|
||||
if (sResRef=="wambo003") return "wambo039";
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
//Weak Acid Arrows
|
||||
if (sResRef =="wamar002") return "acidarrow001";//poor
|
||||
if (sResRef =="nw_wamar001") return "acidarrow002";//normal
|
||||
if (sResRef =="wamar003") return "acidarrow003";//exceptional
|
||||
//Weak Acid Bolts
|
||||
if (sResRef =="wambo002") return "acidbolt001";//poor
|
||||
if (sResRef =="nw_wambo001") return "acidbolt002";//normal
|
||||
if (sResRef =="wambo003") return "acidbolt003";//exceptional
|
||||
}
|
||||
case 15:
|
||||
{
|
||||
//Moderate Acid Arrows
|
||||
if (sResRef =="wamar002") return "acidarrow004";//poor
|
||||
if (sResRef =="nw_wamar001") return "acidarrow005";//normal
|
||||
if (sResRef =="wamar003") return "acidarrow006";//exceptional
|
||||
//Moderate Acid Bolts
|
||||
if (sResRef =="wambo002") return "acidbolt004";//poor
|
||||
if (sResRef =="nw_wambo001") return "acidbolt005";//normal
|
||||
if (sResRef =="wambo003") return "acidbolt006";//exceptional
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
//Strong Acid Arrows
|
||||
if (sResRef =="wamar002") return "acidarrow007";//poor
|
||||
if (sResRef =="nw_wamar001") return "acidarrow008";//normal
|
||||
if (sResRef =="wamar003") return "acidarrow009";//exceptional
|
||||
//Strong Acid Bolts
|
||||
if (sResRef =="wambo002") return "acidbolt007";//poor
|
||||
if (sResRef =="nw_wambo001") return "acidbolt008";//normal
|
||||
if (sResRef =="wambo003") return "acidbolt009";//exceptional
|
||||
}
|
||||
case 17:
|
||||
{
|
||||
//Very Strong Acid Arrows
|
||||
if (sResRef =="wamar002") return "acidarrow010";//poor
|
||||
if (sResRef =="nw_wamar001") return "acidarrow011";//normal
|
||||
if (sResRef =="wamar003") return "acidarrow012";//exceptional
|
||||
//Very Strong Acid Bolts
|
||||
if (sResRef =="wambo002") return "acidbolt010";//poor
|
||||
if (sResRef =="nw_wambo001") return "acidbolt011";//normal
|
||||
if (sResRef =="wambo003") return "acidbolt012";//exceptional
|
||||
}
|
||||
default:
|
||||
{
|
||||
return sResRef;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
int iStackCount = GetNumStackedItems(oTemp);
|
||||
int iTemp = iCount - iStackCount;
|
||||
iStackCount = iStackCount-iCount;
|
||||
DestroyObject(oTemp);
|
||||
if (iStackCount > 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount));
|
||||
DelayCommand(1.0,CreateAnObject(sStackResRef,oPC,iStackCount));
|
||||
}
|
||||
// this next line *should* recursively call this function if the number of
|
||||
// stacked items does not meet the required number of items to be destroyed.
|
||||
if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode, sStackResRef));
|
||||
return;
|
||||
}
|
||||
|
||||
int GetModifier(string sItemTag)
|
||||
{
|
||||
if (sItemTag=="WOOD_NORMAL") return 0;
|
||||
if (sItemTag=="WOOD_OLIVE") return 25;
|
||||
if (sItemTag=="WOOD_WILLOW") return 50;
|
||||
if (sItemTag=="WOOD_PINE") return 75;
|
||||
if (sItemTag=="WOOD_FIR") return 100;
|
||||
if (sItemTag=="WOOD_MANGROVE") return 125;
|
||||
if (sItemTag=="WOOD_CHERRY") return 150;
|
||||
if (sItemTag=="WOOD_MAPLE") return 175;
|
||||
if (sItemTag=="WOOD_ALMOND") return 200;
|
||||
if (sItemTag=="WOOD_HICKORY") return 225;
|
||||
if (sItemTag=="WOOD_BIRCH") return 300;
|
||||
if (sItemTag=="WOOD_ELDER") return 325;
|
||||
if (sItemTag=="WOOD_WALNUT") return 350;
|
||||
if (sItemTag=="WOOD_ELM") return 375;
|
||||
if (sItemTag=="WOOD_MAHOGANY") return 400;
|
||||
if (sItemTag=="WOOD_OAK") return 425;
|
||||
if (sItemTag=="WOOD_YEW") return 450;
|
||||
if (sItemTag=="WOOD_REDWOOD") return 475;
|
||||
if (sItemTag=="WOOD_IRONWOOD") return 500;
|
||||
return 0;
|
||||
}
|
913
_module/nss/_craft_forge.nss
Normal file
913
_module/nss/_craft_forge.nss
Normal file
@@ -0,0 +1,913 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration);
|
||||
string GetIngotType(object oItem, object oPC);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sResmeltMessage = "INVALID";
|
||||
int iResmelt = 0;
|
||||
int iBaseItem=0;
|
||||
int iMaxResmelt;
|
||||
int iMaxResmelt2;
|
||||
int iMaxResmelt3;
|
||||
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
if (sItemTag=="SWITCH_VLOWHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",1);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use very low heat.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="SWITCH_LOWHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",2);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use low heat.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="SWITCH_MEDIUMHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",3);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use normal heat.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="SWITCH_HIGHHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",4);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use high heat.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="SWITCH_VHIGHHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",5);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use very high heat.",oPC,FALSE);
|
||||
}
|
||||
CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem));
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must wait for this batch of ore to finish smelting..",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
iBaseItem = GetBaseItemType(oItem);
|
||||
|
||||
string sIngotResRef = "";
|
||||
int iStackSize = 0;
|
||||
int iMaxStack = 5;
|
||||
string sSuccess = "";
|
||||
|
||||
if (GetStringLeft(sItemTag,3) != "ORE")
|
||||
{
|
||||
//Added Resmelt code 11-25-03 UOAbigail
|
||||
if (iBaseItem==BASE_ITEM_ARMOR) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_BASTARDSWORD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_BATTLEAXE) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_CLUB) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_DAGGER) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_DIREMACE) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_DOUBLEAXE) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_GREATAXE) iResmelt=1;
|
||||
|
||||
if (iBaseItem==BASE_ITEM_GREATSWORD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_HALBERD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_HANDAXE) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_HEAVYFLAIL) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_HELMET) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_KAMA) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_KATANA) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_KUKRI) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_LARGESHIELD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_LIGHTFLAIL) iResmelt=1;
|
||||
|
||||
if (iBaseItem==BASE_ITEM_LIGHTHAMMER) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_LIGHTMACE) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_LONGSWORD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_MORNINGSTAR) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_RAPIER) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_SCIMITAR) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_SCYTHE) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_SHORTSPEAR) iResmelt=1;
|
||||
|
||||
if (iBaseItem==BASE_ITEM_SHORTSWORD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_SICKLE) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_SMALLSHIELD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_TOWERSHIELD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_TWOBLADEDSWORD) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_WARHAMMER) iResmelt=1;
|
||||
if (iBaseItem==BASE_ITEM_THROWINGAXE)
|
||||
{
|
||||
iResmelt=1;
|
||||
if (GetNumStackedItems(oItem)<50) iResmelt=3;
|
||||
}
|
||||
if (iBaseItem==BASE_ITEM_SHURIKEN)
|
||||
{
|
||||
iResmelt=1;
|
||||
if (GetNumStackedItems(oItem)<50) iResmelt=3;
|
||||
}
|
||||
if (iBaseItem==BASE_ITEM_DART)
|
||||
{
|
||||
iResmelt=1;
|
||||
if (GetNumStackedItems(oItem)<50) iResmelt=3;
|
||||
}
|
||||
if (iBaseItem==BASE_ITEM_BULLET)
|
||||
{
|
||||
iResmelt=1;
|
||||
if (GetNumStackedItems(oItem)<50) iResmelt=3;
|
||||
}
|
||||
|
||||
if (iResmelt==0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("You cannot smelt this item!",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
if (iResmelt==3)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("To prevent exploits you cannot smelt this item because it is not a full stack.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//int iSmeltChance = GetTokenPair(oPC,14,2);
|
||||
int iSmeltSkill = GetPersistentInt(oPC,"iSmeltSkill","UOACraft");
|
||||
int iSmeltChance = iSmeltSkill;
|
||||
//int iSmeltSkill = iSmeltChance;
|
||||
string sOre;
|
||||
|
||||
|
||||
|
||||
if (iSmeltChance <350)
|
||||
{
|
||||
iSmeltChance = GetAbilityScore(oPC,ABILITY_STRENGTH)*3;
|
||||
iSmeltChance = iSmeltChance + GetAbilityScore(oPC,ABILITY_DEXTERITY) + GetAbilityScore(oPC,ABILITY_WISDOM);
|
||||
iSmeltChance = iSmeltChance * 3;
|
||||
if (iSmeltChance >350) iSmeltChance = 350;
|
||||
if (iSmeltSkill > iSmeltChance) iSmeltChance = iSmeltSkill;
|
||||
}
|
||||
|
||||
if (iResmelt==0)
|
||||
{
|
||||
if (sItemTag == "ORE_IRON")
|
||||
{
|
||||
if (iSmeltChance < 250) iSmeltChance = 250;
|
||||
sIngotResRef = "ingot001";
|
||||
sOre = "Iron";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_DULL")
|
||||
{
|
||||
if (iSmeltChance <650) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot002";
|
||||
iSmeltChance = iSmeltChance - 100;
|
||||
sOre = "Dull Copper";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_SHADOW")
|
||||
{
|
||||
if (iSmeltChance <700) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot003";
|
||||
iSmeltChance = iSmeltChance - 150;
|
||||
sOre = "Shadow Iron";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_COPPER")
|
||||
{
|
||||
if (iSmeltChance <750) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot004";
|
||||
iSmeltChance = iSmeltChance - 200;
|
||||
sOre = "Copper";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_BRONZE")
|
||||
{
|
||||
if (iSmeltChance <800) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot005";
|
||||
iSmeltChance = iSmeltChance - 250;
|
||||
sOre = "Bronze";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_GOLD")
|
||||
{
|
||||
if (iSmeltChance <850) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot006";
|
||||
iSmeltChance = iSmeltChance - 300;
|
||||
sOre = "Gold";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_AGAPITE")
|
||||
{
|
||||
if (iSmeltChance <900) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot007";
|
||||
iSmeltChance = iSmeltChance - 350;
|
||||
sOre = "Agapite";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_VERITE")
|
||||
{
|
||||
if (iSmeltChance <950) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot008";
|
||||
iSmeltChance = iSmeltChance - 400;
|
||||
sOre = "Verite";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_VALORITE")
|
||||
{
|
||||
if (iSmeltChance <990) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot009";
|
||||
iSmeltChance = iSmeltChance - 450;
|
||||
sOre = "Valorite";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_SILVER")
|
||||
{
|
||||
if (iSmeltChance <800) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot010";
|
||||
iSmeltChance = iSmeltChance - 250;
|
||||
sOre = "Silver";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_MITHRIL")
|
||||
{
|
||||
if (iSmeltChance <950) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot011";
|
||||
iSmeltChance = iSmeltChance - 400;
|
||||
sOre = "Mithril";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_ADAMANTITE")
|
||||
{
|
||||
if (iSmeltChance <990) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot012";
|
||||
iSmeltChance = iSmeltChance - 450;
|
||||
sOre = "Adamantite";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_PLATINUM")
|
||||
{
|
||||
if (iSmeltChance <900) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot013";
|
||||
iSmeltChance = iSmeltChance - 350;
|
||||
sOre = "Platinum";
|
||||
}
|
||||
}
|
||||
|
||||
//Resmelt checks
|
||||
if (iResmelt==1)
|
||||
{
|
||||
//iSmeltChance = iSmeltChance -
|
||||
sIngotResRef = GetIngotType(oItem, oPC);
|
||||
//sResmeltMessage = "Ingot: "+sIngotResRef+" MAX: "+IntToString(GetLocalInt(oPC,"iMaxIngot"))
|
||||
// +" Min Skill: "+IntToString(GetLocalInt(oPC,"iSmeltMinimum"))
|
||||
// +" Penalty: "+IntToString(GetLocalInt(oPC,"iSmeltPenalty"));
|
||||
//SendMessageToPC(oPC,sResmeltMessage);
|
||||
if (sIngotResRef=="INVALID")
|
||||
{
|
||||
SendMessageToPC(oPC,"You cannot smelt this item!");
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
if (iSmeltChance<GetLocalInt(oPC,"iSmeltMinimum")) iSmeltChance=0;
|
||||
iSmeltChance = iSmeltChance - GetLocalInt(oPC,"iSmeltPenalty");
|
||||
iMaxResmelt = GetLocalInt(oPC,"iMaxIngot");
|
||||
DeleteLocalInt(oPC,"iSmeltMininum");
|
||||
DeleteLocalInt(oPC,"iSmeltPenalty");
|
||||
DeleteLocalInt(oPC,"iMaxIngot");
|
||||
//GetIngotQty(oItem)
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (iSmeltChance < 1)
|
||||
{
|
||||
if (iResmelt==0)
|
||||
{
|
||||
FloatingTextStringOnCreature("You have no idea how to smelt this ore.",oPC,FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
FloatingTextStringOnCreature("You have no idea how to resmelt this metal type.",oPC,FALSE);
|
||||
}
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
string sFlame= "";
|
||||
int iHeat = GetLocalInt(oPC,"iHeat");
|
||||
float fAngleToVector = 0.4;
|
||||
|
||||
|
||||
switch(iHeat)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
fAngleToVector = 0.5;
|
||||
iMaxStack = iMaxStack+3;
|
||||
if (iResmelt==0)iSmeltChance = iSmeltChance-250;
|
||||
if (iSmeltChance <1) iSmeltChance=1;
|
||||
sFlame = "plc_flamesmall";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
fAngleToVector = 0.6;
|
||||
iMaxStack = iMaxStack+1;
|
||||
if (iResmelt==0)iSmeltChance = iSmeltChance-100;
|
||||
if (iSmeltChance <1) iSmeltChance=1;
|
||||
sFlame = "plc_flamesmall";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
fAngleToVector = 0.2;
|
||||
iMaxStack = iMaxStack-2;
|
||||
if (iResmelt==0)iSmeltChance = iSmeltChance+100;
|
||||
sFlame = "plc_flamelarge";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
fAngleToVector = 0.3;
|
||||
iMaxStack = iMaxStack -3;
|
||||
if (iResmelt==0)iSmeltChance = iSmeltChance+250;
|
||||
sFlame = "plc_flamelarge";
|
||||
}
|
||||
default:
|
||||
{
|
||||
sFlame = "plc_flamemedium";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
location lSelf = GetLocation(OBJECT_SELF);
|
||||
float fSelf = GetFacing(OBJECT_SELF);
|
||||
vector vSelf = GetPosition(OBJECT_SELF);
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
vFire = vSelf + (AngleToVector(fSelf) * fAngleToVector);
|
||||
location lFire = Location(oArea,vFire,fSelf);
|
||||
object oFire = CreatePlaceable(sFlame, lFire, 6.0);
|
||||
|
||||
AssignCommand(oPC,PlaySound("al_cv_firebowl1"));
|
||||
AssignCommand(oPC,PlaySound("as_cv_mineshovl1"));
|
||||
AssignCommand(oPC,PlaySound("al_na_waterpipe1"));
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,4.0));
|
||||
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE,1.0,6.0);
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(7.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
//ensure at least 1 respawn 10 minutes after used...
|
||||
//this is to prevent a broken placeable that is used, with a 'in use' delay
|
||||
//which would cancel the respawn
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmSetToRespawn")!=99)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"iAmSetToRespawn",99);
|
||||
DelayCommand(600.0,ExecuteScript("_onclose_clear",OBJECT_SELF));
|
||||
}
|
||||
|
||||
if (iResmelt!=0)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
if (Random(500)<=iSmeltChance)
|
||||
{
|
||||
iMaxResmelt2 = iMaxResmelt/2;
|
||||
if (iMaxResmelt2<1) iMaxResmelt2=1;
|
||||
iMaxResmelt3 = iMaxResmelt2/2;
|
||||
if (iMaxResmelt3>0)
|
||||
{
|
||||
for (iMaxResmelt3; iMaxResmelt3>0; iMaxResmelt3--)
|
||||
{
|
||||
if (Random(1000)<= (iSmeltChance-(iMaxResmelt3*50))) iMaxResmelt2++;
|
||||
}
|
||||
}
|
||||
if (iMaxResmelt2<1) iMaxResmelt2=1;
|
||||
sResmeltMessage = "You successfully resmelt the item and recover "+IntToString(iMaxResmelt2)+" ingot";
|
||||
if (iMaxResmelt2>1) sResmeltMessage = sResmeltMessage+"s";
|
||||
sResmeltMessage=sResmeltMessage+".";
|
||||
DelayCommand(5.8,PlaySound("as_cv_minepick2"));
|
||||
DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,1.0)));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_COM_HIT_FIRE,FALSE),OBJECT_SELF,2.0));
|
||||
DelayCommand(6.8,FloatingTextStringOnCreature(sResmeltMessage,oPC,FALSE));
|
||||
DelayCommand(6.9,CreateAnObject(sIngotResRef,oPC,iMaxResmelt2));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(5.5,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_TIRED,1.0,1.0)));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_COM_HIT_ACID,FALSE),OBJECT_SELF,2.0));
|
||||
DelayCommand(5.8,PlaySound("as_na_steamshrt2"));
|
||||
DelayCommand(7.0,FloatingTextStringOnCreature("You burn away the metal into useless slag!",oPC,FALSE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int iRandom = 0;
|
||||
|
||||
int iSuccess = 0;
|
||||
int iSkillGain = 0;
|
||||
|
||||
if (Random(1000) <= iSmeltChance)
|
||||
{
|
||||
iSuccess = 1;
|
||||
iStackSize =1;
|
||||
iMaxStack--;
|
||||
if (iMaxStack >0)
|
||||
{
|
||||
for (iMaxStack; iMaxStack >0; iMaxStack--)
|
||||
{
|
||||
if (Random(1000) <= iSmeltChance) iStackSize++;
|
||||
}
|
||||
}
|
||||
DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,1.0)));
|
||||
DelayCommand(6.0,CreateAnObject(sIngotResRef,oPC,iStackSize));
|
||||
sSuccess = "You successfully smelt the ore into "+IntToString(iStackSize)+" "+sOre+" Ingot";
|
||||
if (iStackSize ==1)
|
||||
{
|
||||
sSuccess = sSuccess+".";
|
||||
}
|
||||
else
|
||||
{
|
||||
sSuccess = sSuccess+"s.";
|
||||
}
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
||||
DelayCommand(5.8,PlaySound("as_cv_minepick2"));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_COM_HIT_FIRE,FALSE),OBJECT_SELF,2.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_TIRED,1.0,1.0)));
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature("You burn away the ore and are left with nothing Useful.",oPC,FALSE));
|
||||
DelayCommand(5.8,PlaySound("as_na_steamshrt2"));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_COM_HIT_ACID,FALSE),OBJECT_SELF,2.0));
|
||||
}
|
||||
DelayCommand(6.0,DestroyObject(oItem));
|
||||
|
||||
if (iSuccess == 1)
|
||||
{
|
||||
iRandom = Random(1000);
|
||||
if (iRandom >= iSmeltSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iSmeltChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iSmeltSkill++;
|
||||
sOldSkill2 = IntToString(iSmeltSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iSmeltSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iSmeltSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(6.0,SetTokenPair(oPC,14,2,iSmeltSkill));
|
||||
DelayCommand(6.0,SetPersistentInt(oPC,"iSmeltSkill",iSmeltSkill,0,"UOACraft"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"==================================="));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Your skill in smelting has gone up!"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Current smelting skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"==================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(5.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
if (iStackSize<=10)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
iStackSize=iStackSize-10;
|
||||
CreateItemOnObject(sResource,oPC,10);
|
||||
DelayCommand(0.5,CreateAnObject(sResource,oPC,iStackSize));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration)
|
||||
{
|
||||
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
||||
if (fDuration != 0.0)
|
||||
DestroyObject(oPlaceable,fDuration);
|
||||
return oPlaceable;
|
||||
}
|
||||
|
||||
string GetIngotType(object oItem, object oPC)
|
||||
{
|
||||
string sIngotResRef;
|
||||
int iValid=0;
|
||||
int iMaxIngot;
|
||||
int iBaseItem = GetBaseItemType(oItem);
|
||||
int iSmeltPenalty;
|
||||
int iSmeltMinimum;
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sResRef = GetResRef(oItem);
|
||||
string sItemTagCut = GetStringRight(sItemTag,GetStringLength(sItemTag)-5);
|
||||
//SendMessageToPC(oPC,sItemTagCut);
|
||||
sIngotResRef = "INVALID";
|
||||
if (GetStringLeft(sItemTagCut,2)=="N_")
|
||||
{
|
||||
sItemTagCut = GetStringRight(sItemTagCut,GetStringLength(sItemTagCut)-2);
|
||||
//SendMessageToPC(oPC,sItemTagCut);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetStringLeft(sItemTagCut,3)=="EX_")
|
||||
{
|
||||
sItemTagCut = GetStringRight(sItemTagCut,GetStringLength(sItemTagCut)-3);
|
||||
//SendMessageToPC(oPC,sItemTagCut);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetStringLeft(sItemTagCut,5)=="POOR_")
|
||||
{
|
||||
sItemTagCut = GetStringRight(sItemTagCut,GetStringLength(sItemTagCut)-5);
|
||||
//SendMessageToPC(oPC,sItemTagCut);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sItemTag=="WEAP_POO_BASTARDSWORD_ADAMANTITE")
|
||||
{
|
||||
sItemTagCut="BASTARDSWORD_ADAMANTITE";
|
||||
iValid=1;
|
||||
}
|
||||
if (iValid==0)
|
||||
{
|
||||
sIngotResRef="INVALID2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -- Commented out to try base item types for ID
|
||||
if (GetStringLeft(sItemTagCut,7)=="BANDED_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="FULLPLATE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="HALFPLATE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,11)=="SPLINTMAIL_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,12)=="BREASTPLATE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="CHAINMAIL_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="SCALEMAIL_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,11)=="CHAINSHIRT_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,9)=="RINGMAIL_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="HORSEHAIR_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="POTHELMET_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,6)=="SPIKE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,5)=="STAG_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,7)=="WINGED_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,6)=="LARGE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,6)=="SMALL_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,6)=="TOWER_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,8)=="HANDAXE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="BATTLEAXE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,13)=="BASTARDSWORD_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,7)=="DAGGER_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,11)=="GREATSWORD_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="LONGSWORD_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,11)=="SHORTSWORD_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,7)=="KATANA_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,7)=="RAPIER_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,9)=="SCIMITAR_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,9)=="HVYFLAIL_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,8)=="LTFLAIL_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,9)=="LTHAMMER_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="WARHAMMER_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,5)=="MACE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,7)=="MORNINGSTAR_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,9)=="DIREMACE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,12)=="2BLADESWORD_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,10)=="DOUBLEAXE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,5)=="KAMA_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,6)=="KUKRI_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,7)=="SICKLE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,8)=="HALBERD_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,7)=="SCYTHE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,6)=="SPEAR_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,5)=="DART_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,9)=="SHURIKEN_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,12)=="THROWINGAXE_") sItemTag="";
|
||||
if (GetStringLeft(sItemTagCut,7)=="BULLET_") sItemTag="";
|
||||
----- Commented out to try base item types instead of tags for ID*/
|
||||
|
||||
|
||||
//If (GetStringLeft(sItemTagCut,7)=="BANDED_") sItemTag="";
|
||||
//if (iBaseItem==BASE_ITEM_ARMOR) iMaxIngot=1;
|
||||
//SendMessageToPC(oPC,sItemTagCut);
|
||||
if (GetStringLeft(sItemTagCut,7)=="BANDED_") iMaxIngot=14;
|
||||
if (GetStringLeft(sItemTagCut,10)=="FULLPLATE_") iMaxIngot=30;
|
||||
if (GetStringLeft(sItemTagCut,10)=="HALFPLATE_") iMaxIngot=20;
|
||||
if (GetStringLeft(sItemTagCut,11)=="SPLINTMAIL_") iMaxIngot=14;
|
||||
if (GetStringLeft(sItemTagCut,12)=="BREASTPLATE_") iMaxIngot=10;
|
||||
if (GetStringLeft(sItemTagCut,10)=="CHAINMAIL_") iMaxIngot=10;
|
||||
if (GetStringLeft(sItemTagCut,10)=="SCALEMAIL_") iMaxIngot=8;
|
||||
if (GetStringLeft(sItemTagCut,11)=="CHAINSHIRT_") iMaxIngot=8;
|
||||
if (GetStringLeft(sItemTagCut,9)=="RINGMAIL_") iMaxIngot=6;
|
||||
|
||||
if (iBaseItem==BASE_ITEM_BASTARDSWORD) iMaxIngot=7;
|
||||
if (iBaseItem==BASE_ITEM_BATTLEAXE) iMaxIngot=7;
|
||||
//if (iBaseItem==BASE_ITEM_CLUB) iMaxIngot=1;
|
||||
if (iBaseItem==BASE_ITEM_DAGGER) iMaxIngot=2;
|
||||
if (iBaseItem==BASE_ITEM_DIREMACE) iMaxIngot=15;
|
||||
if (iBaseItem==BASE_ITEM_DOUBLEAXE) iMaxIngot=15;
|
||||
if (iBaseItem==BASE_ITEM_GREATAXE) iMaxIngot=9;
|
||||
if (iBaseItem==BASE_ITEM_GREATSWORD) iMaxIngot=10;
|
||||
if (iBaseItem==BASE_ITEM_HALBERD) iMaxIngot=20;
|
||||
if (iBaseItem==BASE_ITEM_HANDAXE) iMaxIngot=3;
|
||||
if (iBaseItem==BASE_ITEM_HEAVYFLAIL) iMaxIngot=7;
|
||||
if (iBaseItem==BASE_ITEM_HELMET) iMaxIngot=4; //All helmets the same req.
|
||||
if (iBaseItem==BASE_ITEM_KAMA) iMaxIngot=3;
|
||||
if (iBaseItem==BASE_ITEM_KATANA) iMaxIngot=9;
|
||||
if (iBaseItem==BASE_ITEM_KUKRI) iMaxIngot=4;
|
||||
if (iBaseItem==BASE_ITEM_LARGESHIELD) iMaxIngot=4;
|
||||
if (iBaseItem==BASE_ITEM_LIGHTFLAIL) iMaxIngot=4;
|
||||
if (iBaseItem==BASE_ITEM_LIGHTHAMMER) iMaxIngot=5;
|
||||
if (iBaseItem==BASE_ITEM_LIGHTMACE) iMaxIngot=5;
|
||||
if (iBaseItem==BASE_ITEM_LONGSWORD) iMaxIngot=6;
|
||||
if (iBaseItem==BASE_ITEM_MORNINGSTAR) iMaxIngot=6;
|
||||
if (iBaseItem==BASE_ITEM_RAPIER) iMaxIngot=5;
|
||||
if (iBaseItem==BASE_ITEM_SCIMITAR) iMaxIngot=6;
|
||||
if (iBaseItem==BASE_ITEM_SCYTHE) iMaxIngot=20;
|
||||
if (iBaseItem==BASE_ITEM_SHORTSPEAR) iMaxIngot=3;
|
||||
if (iBaseItem==BASE_ITEM_SHORTSWORD) iMaxIngot=4;
|
||||
if (iBaseItem==BASE_ITEM_SICKLE) iMaxIngot=4;
|
||||
if (iBaseItem==BASE_ITEM_SMALLSHIELD) iMaxIngot=2;
|
||||
if (iBaseItem==BASE_ITEM_TOWERSHIELD) iMaxIngot=10;
|
||||
if (iBaseItem==BASE_ITEM_TWOBLADEDSWORD) iMaxIngot=25;
|
||||
if (iBaseItem==BASE_ITEM_WARHAMMER) iMaxIngot=9;
|
||||
if (iBaseItem==BASE_ITEM_THROWINGAXE) iMaxIngot=6;
|
||||
if (iBaseItem==BASE_ITEM_SHURIKEN) iMaxIngot=4;
|
||||
if (iBaseItem==BASE_ITEM_DART) iMaxIngot=4;
|
||||
if (iBaseItem==BASE_ITEM_BULLET) iMaxIngot=10;
|
||||
|
||||
if (GetStringRight(sItemTag,7)=="_NORMAL")
|
||||
{
|
||||
iSmeltPenalty=0;
|
||||
iSmeltMinimum=250;
|
||||
sIngotResRef= "ingot001";
|
||||
}
|
||||
if (GetStringRight(sItemTag,5)=="_DULL")
|
||||
{
|
||||
iSmeltPenalty=100;
|
||||
iSmeltMinimum=650;
|
||||
sIngotResRef= "ingot002";
|
||||
}
|
||||
if (GetStringRight(sItemTag,7)=="_SHADOW")
|
||||
{
|
||||
iSmeltPenalty=150;
|
||||
iSmeltMinimum=700;
|
||||
sIngotResRef= "ingot003";
|
||||
}
|
||||
if (GetStringRight(sItemTag,7)=="_COPPER")
|
||||
{
|
||||
iSmeltPenalty=200;
|
||||
iSmeltMinimum=750;
|
||||
sIngotResRef= "ingot004";
|
||||
}
|
||||
if (GetStringRight(sItemTag,7)=="_BRONZE")
|
||||
{
|
||||
iSmeltPenalty=250;
|
||||
iSmeltMinimum=800;
|
||||
sIngotResRef= "ingot005";
|
||||
}
|
||||
if (GetStringRight(sItemTag,5)=="_GOLD")
|
||||
{
|
||||
iSmeltPenalty=300;
|
||||
iSmeltMinimum=850;
|
||||
sIngotResRef= "ingot006";
|
||||
}
|
||||
if (GetStringRight(sItemTag,8)=="_AGAPITE")
|
||||
{
|
||||
iSmeltPenalty=350;
|
||||
iSmeltMinimum=900;
|
||||
sIngotResRef= "ingot007";
|
||||
}
|
||||
if (GetStringRight(sItemTag,7)=="_VERITE")
|
||||
{
|
||||
iSmeltPenalty=400;
|
||||
iSmeltMinimum=950;
|
||||
sIngotResRef= "ingot008";
|
||||
}
|
||||
if (GetStringRight(sItemTag,9)=="_VALORITE")
|
||||
{
|
||||
iSmeltPenalty=450;
|
||||
iSmeltMinimum=990;
|
||||
sIngotResRef= "ingot009";
|
||||
}
|
||||
if (GetStringRight(sItemTag,7)=="_SILVER")
|
||||
{
|
||||
iSmeltPenalty=250;
|
||||
iSmeltMinimum=800;
|
||||
sIngotResRef= "ingot010";
|
||||
}
|
||||
if (GetStringRight(sItemTag,9)=="_PLATINUM")
|
||||
{
|
||||
iSmeltPenalty=350;
|
||||
iSmeltMinimum=900;
|
||||
sIngotResRef= "ingot013";
|
||||
}
|
||||
if (GetStringRight(sItemTag,8)=="_MITHRIL")
|
||||
{
|
||||
iSmeltPenalty=400;
|
||||
iSmeltMinimum=950;
|
||||
sIngotResRef= "ingot011";
|
||||
}
|
||||
if (GetStringRight(sItemTag,11)=="_ADAMANTITE")
|
||||
{
|
||||
if ( (sResRef == "wblhl037") || (sResRef == "wblhl038") || (sResRef == "wblhl039") ) //platinum hammer
|
||||
{
|
||||
iSmeltPenalty=450;
|
||||
iSmeltMinimum=990;
|
||||
sIngotResRef= "ingot013";
|
||||
}
|
||||
else
|
||||
{
|
||||
iSmeltPenalty=450;
|
||||
iSmeltMinimum=990;
|
||||
sIngotResRef= "ingot012";
|
||||
}
|
||||
}
|
||||
|
||||
//Normal quality iron items have nwn default tags
|
||||
//SendMessageToPC(oPC,"Checkpoint 1: "+sIngotResRef);
|
||||
if (sIngotResRef=="INVALID2")
|
||||
{
|
||||
if (sItemTag=="NW_AARCL011")
|
||||
{
|
||||
sIngotResRef="ingot001"; //banded mail
|
||||
iMaxIngot=14;
|
||||
}
|
||||
if (sItemTag=="NW_AARCL007")
|
||||
{
|
||||
sIngotResRef="ingot001"; //Full Plate
|
||||
iMaxIngot=30;
|
||||
}
|
||||
if (sItemTag=="NW_AARCL006")
|
||||
{
|
||||
sIngotResRef="ingot001"; //Half Plate
|
||||
iMaxIngot=20;
|
||||
}
|
||||
if (sItemTag=="NW_AARCL005")
|
||||
{
|
||||
sIngotResRef="ingot001"; //Splint Mail
|
||||
iMaxIngot=14;
|
||||
}
|
||||
if (sItemTag=="NW_AARCL010")
|
||||
{
|
||||
sIngotResRef="ingot001"; //Breast Plate
|
||||
iMaxIngot=10;
|
||||
}
|
||||
if (sItemTag=="NW_AARCL004")
|
||||
{
|
||||
sIngotResRef="ingot001"; //Chainmail
|
||||
iMaxIngot=10;
|
||||
}
|
||||
if (sItemTag=="NW_AARCL003")
|
||||
{
|
||||
sIngotResRef="ingot001"; //Scale Mail
|
||||
iMaxIngot=8;
|
||||
}
|
||||
if (sItemTag=="NW_AARCL012")
|
||||
{
|
||||
sIngotResRef="ingot001"; //Chain Shirt
|
||||
iMaxIngot=8;
|
||||
}
|
||||
|
||||
if (sItemTag=="NW_WAMBU001") sIngotResRef="ingot001"; //bullet
|
||||
if (sItemTag=="NW_ARHE004") sIngotResRef="ingot001"; //Horse Hair Helmet
|
||||
if (sItemTag=="NW_ARHE001") sIngotResRef="ingot001"; //Pot Helmet
|
||||
if (sItemTag=="NW_ARHE002") sIngotResRef="ingot001"; //Spike Helmet
|
||||
if (sItemTag=="NW_ARHE005") sIngotResRef="ingot001"; //Stag Helmet
|
||||
if (sItemTag=="NW_ARHE003") sIngotResRef="ingot001"; //Winged Helmet
|
||||
if (sItemTag=="NW_ASHLW001") sIngotResRef="ingot001"; //Large Shield
|
||||
if (sItemTag=="NW_ASHSW001") sIngotResRef="ingot001"; //Small Shield
|
||||
if (sItemTag=="NW_ASHTO001") sIngotResRef="ingot001"; //Tower Shield
|
||||
if (sItemTag=="NW_WAXHN001") sIngotResRef="ingot001"; //Handaxe
|
||||
if (sItemTag=="NW_WAXBT001") sIngotResRef="ingot001"; //Battle Axe
|
||||
if (sItemTag=="NW_WSWBS001") sIngotResRef="ingot001"; //Bastard Sword
|
||||
if (sItemTag=="NW_WSWDG001") sIngotResRef="ingot001"; //Dagger
|
||||
if (sItemTag=="NW_WSWGS001") sIngotResRef="ingot001"; //Greatsword
|
||||
if (sItemTag=="NW_WSWLS001") sIngotResRef="ingot001"; //Longsword
|
||||
if (sItemTag=="NW_WSWSS001") sIngotResRef="ingot001"; //Shortsword
|
||||
if (sItemTag=="NW_WSWKA001") sIngotResRef="ingot001"; //Katana
|
||||
if (sItemTag=="NW_WSWRP001") sIngotResRef="ingot001"; //Rapier
|
||||
if (sItemTag=="NW_WSWSC001") sIngotResRef="ingot001"; //Scimitar
|
||||
if (sItemTag=="NW_WBLFH001") sIngotResRef="ingot001"; //Hvy Flail
|
||||
if (sItemTag=="NW_WBLFL001") sIngotResRef="ingot001"; //Lt Flail
|
||||
if (sItemTag=="NW_WBLHL001") sIngotResRef="ingot001"; //Lt Hammer
|
||||
if (sItemTag=="NW_WBLHW001") sIngotResRef="ingot001"; //Warhammer
|
||||
if (sItemTag=="NW_WBLML001") sIngotResRef="ingot001"; //Mace
|
||||
if (sItemTag=="NW_WBLMS001") sIngotResRef="ingot001"; //Morningstar
|
||||
if (sItemTag=="NW_WDBMA001") sIngotResRef="ingot001"; //Dire Mace
|
||||
if (sItemTag=="NW_WDBSW001") sIngotResRef="ingot001"; //Two-Bladed Sword
|
||||
if (sItemTag=="NW_WDBAX001") sIngotResRef="ingot001"; //Double Axe
|
||||
if (sItemTag=="NW_WSPKA001") sIngotResRef="ingot001"; //Kama
|
||||
if (sItemTag=="NW_WSPKU001") sIngotResRef="ingot001"; //Kukri
|
||||
if (sItemTag=="NW_WSPSC001") sIngotResRef="ingot001"; //Sickle
|
||||
if (sItemTag=="NW_WPLHB001") sIngotResRef="ingot001"; //Halberd
|
||||
if (sItemTag=="NW_WPLSC001") sIngotResRef="ingot001"; //Scythe
|
||||
if (sItemTag=="NW_WPLSS001") sIngotResRef="ingot001"; //Spear
|
||||
if (sItemTag=="NW_WTHDT001") sIngotResRef="ingot001"; //Dart
|
||||
if (sItemTag=="NW_WTHSH001") sIngotResRef="ingot001"; //Shuriken
|
||||
if (sItemTag=="NW_WTHAX001") sIngotResRef="ingot001"; //Throwing Axe
|
||||
//SendMessageToPC(oPC,"Checkpoint 2: "+sIngotResRef);
|
||||
//SendMessageToPC(oPC,"Ingots: "+IntToString(iMaxIngot));
|
||||
//SendMessageToPC(oPC,"TAG: "+sItemTag);
|
||||
//if (sItemTag=="") sIngotResRef="ingot001"; //
|
||||
if (sIngotResRef=="INVALID2")
|
||||
{
|
||||
return "INVALID";
|
||||
}
|
||||
else
|
||||
{
|
||||
iSmeltPenalty=0;
|
||||
iSmeltMinimum=250;
|
||||
}
|
||||
}
|
||||
if (iMaxIngot==0) return "INVALID";
|
||||
|
||||
//filter out non-smithy items that end in _NORMAL
|
||||
if (sIngotResRef=="ingot001")
|
||||
{
|
||||
iValid = 0;
|
||||
string sTagLeft = GetStringLeft(sItemTag,5);
|
||||
if (sTagLeft=="WEAP_") iValid=1;
|
||||
if (sTagLeft=="ARMR_") iValid=1;
|
||||
if (sTagLeft=="SHLD_") iValid=1;
|
||||
if (sTagLeft=="HELM_") iValid=1;
|
||||
if (GetStringLeft(sItemTag,3)=="NW_") iValid=1;
|
||||
if (sTagLeft=="ITEM_")
|
||||
{
|
||||
if (GetStringLeft(sItemTag,16)=="ITEM_N_ARROWHEAD") iValid=1;
|
||||
if (GetStringLeft(sItemTag,17)=="ITEM_EX_ARROWHEAD") iValid=1;
|
||||
if (GetStringLeft(sItemTag,19)=="ITEM_POOR_ARROWHEAD") iValid=1;
|
||||
|
||||
if (GetStringLeft(sItemTag,14)=="ITEM_N_BOLTTIP") iValid=1;
|
||||
if (GetStringLeft(sItemTag,15)=="ITEM_EX_BOLTTIP") iValid=1;
|
||||
if (GetStringLeft(sItemTag,17)=="ITEM_POOR_BOLTTIP") iValid=1;
|
||||
|
||||
if (GetStringLeft(sItemTag,16)=="ITEM_N_METALSTUD") iValid=1;
|
||||
if (GetStringLeft(sItemTag,17)=="ITEM_EX_METALSTUD") iValid=1;
|
||||
if (GetStringLeft(sItemTag,19)=="ITEM_POOR_METALSTUD") iValid=1;
|
||||
}
|
||||
if (iValid==0) sIngotResRef="INVALID";
|
||||
//SendMessageToPC(oPC,"Checkpoint 3: "+sIngotResRef);
|
||||
}
|
||||
|
||||
|
||||
SetLocalInt(oPC,"iMaxIngot",iMaxIngot);
|
||||
SetLocalInt(oPC,"iSmeltMinimum",iSmeltMinimum);
|
||||
SetLocalInt(oPC,"iSmeltPenalty",iSmeltPenalty);
|
||||
|
||||
return sIngotResRef;
|
||||
}
|
383
_module/nss/_craft_forge_bak.nss
Normal file
383
_module/nss/_craft_forge_bak.nss
Normal file
@@ -0,0 +1,383 @@
|
||||
//#include "_persist_01a"
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
if (sItemTag=="SWITCH_VLOWHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",1);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use very low heat.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="SWITCH_LOWHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",2);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use low heat.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="SWITCH_MEDIUMHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",3);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use normal heat.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="SWITCH_HIGHHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",4);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use high heat.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="SWITCH_VHIGHHEAT")
|
||||
{
|
||||
SetLocalInt(oPC,"iHeat",5);
|
||||
FloatingTextStringOnCreature("Smelting forge is now set to use very high heat.",oPC,FALSE);
|
||||
}
|
||||
CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem));
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must wait for this batch of ore to finish smelting..",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
string sIngotResRef = "";
|
||||
int iStackSize = 0;
|
||||
int iMaxStack = 5;
|
||||
string sSuccess = "";
|
||||
|
||||
if (GetStringLeft(sItemTag,3) != "ORE")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("You cannot smelt this item!",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
//int iSmeltChance = GetTokenPair(oPC,14,2);
|
||||
int iSmeltSkill = GetCampaignInt("UOACraft","iSmeltSkill",oPC);
|
||||
int iSmeltChance = iSmeltSkill;
|
||||
//int iSmeltSkill = iSmeltChance;
|
||||
string sOre;
|
||||
|
||||
if (iSmeltChance <350)
|
||||
{
|
||||
iSmeltChance = GetAbilityScore(oPC,ABILITY_STRENGTH)*3;
|
||||
iSmeltChance = iSmeltChance + GetAbilityScore(oPC,ABILITY_DEXTERITY) + GetAbilityScore(oPC,ABILITY_WISDOM);
|
||||
iSmeltChance = iSmeltChance * 3;
|
||||
if (iSmeltChance >350) iSmeltChance = 350;
|
||||
if (iSmeltSkill > iSmeltChance) iSmeltChance = iSmeltSkill;
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_IRON")
|
||||
{
|
||||
if (iSmeltChance < 250) iSmeltChance = 250;
|
||||
sIngotResRef = "ingot001";
|
||||
sOre = "Iron";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_DULL")
|
||||
{
|
||||
if (iSmeltChance <650) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot002";
|
||||
iSmeltChance = iSmeltChance - 100;
|
||||
sOre = "Dull Copper";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_SHADOW")
|
||||
{
|
||||
if (iSmeltChance <700) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot003";
|
||||
iSmeltChance = iSmeltChance - 150;
|
||||
sOre = "Shadow Iron";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_COPPER")
|
||||
{
|
||||
if (iSmeltChance <750) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot004";
|
||||
iSmeltChance = iSmeltChance - 200;
|
||||
sOre = "Copper";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_BRONZE")
|
||||
{
|
||||
if (iSmeltChance <800) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot005";
|
||||
iSmeltChance = iSmeltChance - 250;
|
||||
sOre = "Bronze";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_GOLD")
|
||||
{
|
||||
if (iSmeltChance <850) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot006";
|
||||
iSmeltChance = iSmeltChance - 300;
|
||||
sOre = "Gold";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_AGAPITE")
|
||||
{
|
||||
if (iSmeltChance <900) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot007";
|
||||
iSmeltChance = iSmeltChance - 350;
|
||||
sOre = "Agapite";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_VERITE")
|
||||
{
|
||||
if (iSmeltChance <950) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot008";
|
||||
iSmeltChance = iSmeltChance - 400;
|
||||
sOre = "Verite";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_VALORITE")
|
||||
{
|
||||
if (iSmeltChance <990) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot009";
|
||||
iSmeltChance = iSmeltChance - 450;
|
||||
sOre = "Valorite";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_SILVER")
|
||||
{
|
||||
if (iSmeltChance <800) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot010";
|
||||
iSmeltChance = iSmeltChance - 250;
|
||||
sOre = "Silver";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_MITHRIL")
|
||||
{
|
||||
if (iSmeltChance <950) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot011";
|
||||
iSmeltChance = iSmeltChance - 400;
|
||||
sOre = "Mithril";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_ADAMANTITE")
|
||||
{
|
||||
if (iSmeltChance <990) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot012";
|
||||
iSmeltChance = iSmeltChance - 450;
|
||||
sOre = "Adamantite";
|
||||
}
|
||||
|
||||
if (sItemTag == "ORE_PLATINUM")
|
||||
{
|
||||
if (iSmeltChance <900) iSmeltChance = 0;
|
||||
sIngotResRef = "ingot013";
|
||||
iSmeltChance = iSmeltChance - 350;
|
||||
sOre = "Platinum";
|
||||
}
|
||||
|
||||
if (iSmeltChance < 1)
|
||||
{
|
||||
FloatingTextStringOnCreature("You have no idea how to smelt this ore.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
string sFlame= "";
|
||||
int iHeat = GetLocalInt(oPC,"iHeat");
|
||||
float fAngleToVector = 0.4;
|
||||
|
||||
|
||||
switch(iHeat)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
fAngleToVector = 0.5;
|
||||
iMaxStack = iMaxStack+3;
|
||||
iSmeltChance = iSmeltChance-250;
|
||||
if (iSmeltChance <1) iSmeltChance=1;
|
||||
sFlame = "plc_flamesmall";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
fAngleToVector = 0.6;
|
||||
iMaxStack = iMaxStack+1;
|
||||
iSmeltChance = iSmeltChance-100;
|
||||
if (iSmeltChance <1) iSmeltChance=1;
|
||||
sFlame = "plc_flamesmall";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
fAngleToVector = 0.2;
|
||||
iMaxStack = iMaxStack-2;
|
||||
iSmeltChance = iSmeltChance+100;
|
||||
sFlame = "plc_flamelarge";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
fAngleToVector = 0.3;
|
||||
iMaxStack = iMaxStack -3;
|
||||
iSmeltChance = iSmeltChance+250;
|
||||
sFlame = "plc_flamelarge";
|
||||
}
|
||||
default:
|
||||
{
|
||||
sFlame = "plc_flamemedium";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
location lSelf = GetLocation(OBJECT_SELF);
|
||||
float fSelf = GetFacing(OBJECT_SELF);
|
||||
vector vSelf = GetPosition(OBJECT_SELF);
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
vFire = vSelf + (AngleToVector(fSelf) * fAngleToVector);
|
||||
location lFire = Location(oArea,vFire,fSelf);
|
||||
object oFire = CreatePlaceable(sFlame, lFire, 6.0);
|
||||
|
||||
AssignCommand(oPC,PlaySound("al_cv_firebowl1"));
|
||||
AssignCommand(oPC,PlaySound("as_cv_mineshovl1"));
|
||||
AssignCommand(oPC,PlaySound("al_na_waterpipe1"));
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,4.0));
|
||||
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE,1.0,6.0);
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(7.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
//ensure at least 1 respawn 10 minutes after used...
|
||||
//this is to prevent a broken placeable that is used, with a 'in use' delay
|
||||
//which would cancel the respawn
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmSetToRespawn")!=99)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"iAmSetToRespawn",99);
|
||||
DelayCommand(600.0,ExecuteScript("_onclose_clear",OBJECT_SELF));
|
||||
}
|
||||
|
||||
int iRandom = 0;
|
||||
|
||||
int iSuccess = 0;
|
||||
int iSkillGain = 0;
|
||||
|
||||
if (Random(1000) <= iSmeltChance)
|
||||
{
|
||||
iSuccess = 1;
|
||||
iStackSize =1;
|
||||
iMaxStack--;
|
||||
if (iMaxStack >0)
|
||||
{
|
||||
for (iMaxStack; iMaxStack >0; iMaxStack--)
|
||||
{
|
||||
if (Random(1000) <= iSmeltChance) iStackSize++;
|
||||
}
|
||||
}
|
||||
DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,1.0)));
|
||||
DelayCommand(6.0,CreateAnObject(sIngotResRef,oPC,iStackSize));
|
||||
sSuccess = "You successfully smelt the ore into "+IntToString(iStackSize)+" "+sOre+" Ingot";
|
||||
if (iStackSize ==1)
|
||||
{
|
||||
sSuccess = sSuccess+".";
|
||||
}
|
||||
else
|
||||
{
|
||||
sSuccess = sSuccess+"s.";
|
||||
}
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
||||
DelayCommand(5.8,PlaySound("as_cv_minepick2"));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_COM_HIT_FIRE,FALSE),OBJECT_SELF,2.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_TIRED,1.0,1.0)));
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature("You burn away the ore and are left with nothing Useful.",oPC,FALSE));
|
||||
DelayCommand(5.8,PlaySound("as_na_steamshrt2"));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_COM_HIT_ACID,FALSE),OBJECT_SELF,2.0));
|
||||
}
|
||||
DelayCommand(6.0,DestroyObject(oItem));
|
||||
|
||||
if (iSuccess == 1)
|
||||
{
|
||||
iRandom = Random(1000);
|
||||
if (iRandom > iSmeltSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iSmeltSkill/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iSmeltSkill++;
|
||||
sOldSkill2 = IntToString(iSmeltSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iSmeltSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iSmeltSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(6.0,SetTokenPair(oPC,14,2,iSmeltSkill));
|
||||
DelayCommand(6.0,SetCampaignInt("UOACraft","iSmeltSkill",iSmeltSkill,oPC));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"==================================="));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Your skill in smelting has gone up!"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Current smelting skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"==================================="));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration)
|
||||
{
|
||||
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
||||
if (fDuration != 0.0)
|
||||
DestroyObject(oPlaceable,fDuration);
|
||||
return oPlaceable;
|
||||
}
|
228
_module/nss/_craft_gembath.nss
Normal file
228
_module/nss/_craft_gembath.nss
Normal file
@@ -0,0 +1,228 @@
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sSuccess = "";
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
|
||||
|
||||
if (GetStringLeft(sItemTag,9)!="GEMSTONE_")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("This is not a gemstone...",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("The mineral bath is not yet ready for more gemstones...",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
object oAcid = GetItemPossessedBy(oPC,"ACID_WEAK");
|
||||
if (oAcid == OBJECT_INVALID)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You must have some weak acid in order to activate the mineral bath.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
int iAcidStack = GetNumStackedItems(oAcid)-1;
|
||||
DestroyObject(oAcid);
|
||||
if (iAcidStack >0) DelayCommand(1.0,CreateAnObject("acid001",oPC,iAcidStack));
|
||||
string sGemResRef = "";
|
||||
|
||||
if (sItemTag =="GEMSTONE_ORNAMENTAL")
|
||||
{
|
||||
switch (d12(1))
|
||||
{
|
||||
case 1:{sGemResRef = "azurite001";sSuccess="azurite";break;}
|
||||
case 2:{sGemResRef = "bandedagate001";sSuccess="banded agate";break;}
|
||||
case 3:{sGemResRef = "bluequartz001";sSuccess="blue quartz";break;}
|
||||
case 4:{sGemResRef = "eyeagate001";sSuccess="eye agate";break;}
|
||||
case 5:{sGemResRef = "hematite001";sSuccess="hematite";break;}
|
||||
case 6:{sGemResRef = "lapislazuli001";sSuccess="lapis lazuli";break;}
|
||||
case 7:{sGemResRef = "malachite001";sSuccess="malachite";break;}
|
||||
case 8:{sGemResRef = "mossagate001";sSuccess="moss agate";break;}
|
||||
case 9:{sGemResRef = "obsidian001";sSuccess="obsidian";break;}
|
||||
case 10:{sGemResRef = "rhodochrosite001";sSuccess="rhodochrosite";break;}
|
||||
case 11:{sGemResRef = "tigereye001";sSuccess="tiger eye";break;}
|
||||
default:{sGemResRef = "turquoise001";sSuccess="turquoise";break;}
|
||||
}
|
||||
}
|
||||
|
||||
if (sItemTag =="GEMSTONE_SEMIPRECIOUS")
|
||||
{
|
||||
switch (Random(13))
|
||||
{
|
||||
case 1:{sGemResRef = "bloodstone001";sSuccess="bloodstone";break;}
|
||||
case 2:{sGemResRef = "carnelian001";sSuccess="carnelian";break;}
|
||||
case 3:{sGemResRef = "chalcendony001";sSuccess="chalcendony";break;}
|
||||
case 4:{sGemResRef = "chrysoprase001";sSuccess="chrysoprase";break;}
|
||||
case 5:{sGemResRef = "citrine001";sSuccess="citrine";break;}
|
||||
case 6:{sGemResRef = "jasper001";sSuccess="jasper";break;}
|
||||
case 7:{sGemResRef = "moonstone001";sSuccess="moonstone";break;}
|
||||
case 8:{sGemResRef = "onyx001";sSuccess="onyx";break;}
|
||||
case 9:{sGemResRef = "rockcrystal001";sSuccess="rock crystal";break;}
|
||||
case 10:{sGemResRef = "sardonyx001";sSuccess="sardonyx";break;}
|
||||
case 11:{sGemResRef = "smokyquartz001";sSuccess="smoky quartz";break;}
|
||||
case 12:{sGemResRef = "zircon001";sSuccess="zircon";break;}
|
||||
default:{sGemResRef = "starrosequart001";sSuccess="star rose quartz";break;}
|
||||
}
|
||||
}
|
||||
|
||||
if (sItemTag =="GEMSTONE_FANCY")
|
||||
{
|
||||
switch (Random(11))
|
||||
{
|
||||
case 1:{sGemResRef = "amber001";sSuccess="amber";break;}
|
||||
case 2:{sGemResRef = "alexandrite001";sSuccess="alexandrite";break;}
|
||||
case 3:{sGemResRef = "amethyst001";sSuccess="amethyst";break;}
|
||||
case 4:{sGemResRef = "chrysoberyl001";sSuccess="chrysoberyl";break;}
|
||||
case 5:{sGemResRef = "coral001";sSuccess="coral";break;}
|
||||
case 6:{sGemResRef = "garnetsmall001";sSuccess="red garnet";break;}
|
||||
case 7:{sGemResRef = "jade001";sSuccess="jade";break;}
|
||||
case 8:{sGemResRef = "jet001";sSuccess="jet";break;}
|
||||
case 9:{sGemResRef = "whitepearl001";sSuccess="white pearl";break;}
|
||||
case 10:{sGemResRef = "spinel001";sSuccess="red spinel";break;}
|
||||
default:{sGemResRef = "tourmaline001";sSuccess="tourmaline";break;}
|
||||
}
|
||||
}
|
||||
|
||||
if (sItemTag =="GEMSTONE_PRECIOUS")
|
||||
{
|
||||
switch (d6(1))
|
||||
{
|
||||
case 1:{sGemResRef = "aquamarine001";sSuccess="aquamarine";break;}
|
||||
case 2:{sGemResRef = "garnetviolet001";sSuccess="violet garnet";break;}
|
||||
case 3:{sGemResRef = "blackpearl001";sSuccess="black pearl";break;}
|
||||
case 4:{sGemResRef = "peridot001";sSuccess="peridot";break;}
|
||||
case 5:{sGemResRef = "bluespinel001";sSuccess="blue spinel";break;}
|
||||
default:{sGemResRef = "topaz001";sSuccess="topaz";break;}
|
||||
}
|
||||
}
|
||||
|
||||
if (sItemTag =="GEMSTONE_GEM")
|
||||
{
|
||||
switch (Random(9))
|
||||
{
|
||||
case 1:{sGemResRef = "blackopal001";sSuccess="black opal";break;}
|
||||
case 2:{sGemResRef = "emerald001";sSuccess="emerald";break;}
|
||||
case 3:{sGemResRef = "fireopal001";sSuccess="fire opal";break;}
|
||||
case 4:{sGemResRef = "opal001";sSuccess="opal";break;}
|
||||
case 5:{sGemResRef = "orientalameth001";sSuccess="oriental emerald";break;}
|
||||
case 6:{sGemResRef = "orientaltopaz001";sSuccess="oriental topaz";break;}
|
||||
case 7:{sGemResRef = "sapphire001";sSuccess="sapphire";break;}
|
||||
case 8:{sGemResRef = "starruby001";sSuccess="star ruby";break;}
|
||||
default:{sGemResRef = "starsapphire001";sSuccess="star sapphire";break;}
|
||||
}
|
||||
}
|
||||
|
||||
if (sItemTag =="GEMSTONE_JEWEL")
|
||||
{
|
||||
switch (Random(5))
|
||||
{
|
||||
case 1:{sGemResRef = "blacksapphire001";sSuccess="black sapphire";break;}
|
||||
case 2:{sGemResRef = "diamond001";sSuccess="diamond";break;}
|
||||
case 3:{sGemResRef = "jacinth001";sSuccess="jacinth";break;}
|
||||
case 4:{sGemResRef = "orientalemera001";sSuccess="oriental emerald";break;}
|
||||
default:{sGemResRef = "ruby001";sSuccess="ruby";break;}
|
||||
}
|
||||
}
|
||||
|
||||
sSuccess = "The mineral bath reveals the gemstone to be "+sSuccess+".";
|
||||
|
||||
// This snippet of code is cut-n-paste direct from ATS
|
||||
// Reason for this is because I had no clue how to assign an increase
|
||||
// in the z-axis of the location of the anvil for sparks to display.
|
||||
// After reading through this code, it is obvious that vEffecrPos.z
|
||||
// is the line which assigns this. Due to my own ignorance in this issue
|
||||
// I have decided to leave this snippet of code intact with this credit to
|
||||
// the original ATS script coders, whomever they may have been.
|
||||
//The only modification to this code is locAnvil was changed to locBath.
|
||||
|
||||
location locBath = GetLocation(OBJECT_SELF);
|
||||
vector vEffectPos = GetPositionFromLocation(locBath);
|
||||
vEffectPos.z += 1.0;
|
||||
location locEffect = Location( GetAreaFromLocation(locBath), vEffectPos,GetFacingFromLocation(locBath) );
|
||||
// End snippet
|
||||
|
||||
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect);
|
||||
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_FIRE), locEffect);
|
||||
DelayCommand(0.2,PlaySound("as_cv_smithwatr1"));
|
||||
DelayCommand(0.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_WHITE), locEffect));
|
||||
DelayCommand(1.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(1.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(1.8,PlaySound("al_cv_firepot1"));
|
||||
DelayCommand(2.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(2.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE), locEffect));
|
||||
DelayCommand(3.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_WHITE), locEffect));
|
||||
DelayCommand(3.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(4.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(4.5,PlaySound("as_na_steamshrt2"));
|
||||
DelayCommand(5.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_BLUE_RED), locEffect));
|
||||
DelayCommand(5.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(5.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(6.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(6.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE), locEffect));
|
||||
DelayCommand(7.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE), locEffect));
|
||||
DelayCommand(7.2,PlaySound("as_na_steamshrt1"));
|
||||
DelayCommand(7.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(8.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect));
|
||||
DelayCommand(8.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(9.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_BLUE_RED), locEffect));
|
||||
DelayCommand(9.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
|
||||
|
||||
DestroyObject(oItem);
|
||||
int iNum = d6(3)/3;
|
||||
ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE,1.0,9.6);
|
||||
DelayCommand(9.7,ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE,1.0,10.0));
|
||||
|
||||
AssignCommand(oPC,PlaySound("as_cv_potclang1"));
|
||||
AssignCommand(oPC,DelayCommand(0.2,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,9.5)));
|
||||
AssignCommand(oPC,DelayCommand(9.5,CreateAnObject(sGemResRef,oPC,iNum)));
|
||||
AssignCommand(oPC,DelayCommand(8.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
if (iNum>1)
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(10.0,FloatingTextStringOnCreature("The mineral bath reveals "+IntToString(iNum)+" gems.",oPC,FALSE)));
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(10.0,FloatingTextStringOnCreature("The mineral bath reveals a single gem.",oPC,FALSE)));
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(10.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
328
_module/nss/_craft_gemcutter.nss
Normal file
328
_module/nss/_craft_gemcutter.nss
Normal file
@@ -0,0 +1,328 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sItemResRef = GetResRef(oItem);
|
||||
string sSuccess = "";
|
||||
|
||||
|
||||
|
||||
|
||||
if (GetInventoryDisturbType() != INVENTORY_DISTURB_TYPE_ADDED) return;
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
|
||||
|
||||
if (GetStringLeft(sItemTag,13)!="GEM_POLISHED_")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("This is not a polished gem...",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("You must first finish cutting the current gem before starting another.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
if (GetLocalInt(oPC,"iAmDigging")!=0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("You may only use one gemcutting station at a time!",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
//int iGemSkill = GetTokenPair(oPC,13,7);
|
||||
int iGemSkill = GetPersistentInt(oPC,"iGemSkill","UOACraft");
|
||||
int iGemChance = iGemSkill;
|
||||
if (iGemSkill <350)
|
||||
{
|
||||
iGemChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iGemChance = iGemChance + (GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iGemChance = iGemChance + (GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
|
||||
iGemChance = iGemChance *3;
|
||||
if (iGemChance>350)iGemChance = 350;
|
||||
if (iGemSkill>iGemChance) iGemChance = iGemSkill;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int iPenalty = 0;
|
||||
if (sItemTag=="GEM_POLISHED_AZURITE") iPenalty=10;
|
||||
if (sItemTag=="GEM_POLISHED_BANDEDAGATE") iPenalty=20;
|
||||
if (sItemTag=="GEM_POLISHED_BLUEQUARTZ") iPenalty=30;
|
||||
if (sItemTag=="GEM_POLISHED_EYEAGATE") iPenalty=40;
|
||||
if (sItemTag=="GEM_POLISHED_HEMATITE") iPenalty=50;
|
||||
if (sItemTag=="GEM_POLISHED_LAPISLAZULI") iPenalty=60;
|
||||
if (sItemTag=="GEM_POLISHED_MALACHITE") iPenalty=70;
|
||||
if (sItemTag=="GEM_POLISHED_MOSSAGATE") iPenalty=80;
|
||||
if (sItemTag=="GEM_POLISHED_OBSIDIAN") iPenalty=90;
|
||||
if (sItemTag=="GEM_POLISHED_RHODOCHROSITE") iPenalty=10;
|
||||
if (sItemTag=="GEM_POLISHED_TIGEREYE") iPenalty=110;
|
||||
if (sItemTag=="GEM_POLISHED_TURQUOISE") iPenalty=120;
|
||||
//
|
||||
if (sItemTag=="GEM_POLISHED_BLOODSTONE") iPenalty=130;
|
||||
if (sItemTag=="GEM_POLISHED_CARNELIAN") iPenalty=140;
|
||||
if (sItemTag=="GEM_POLISHED_CHALCENDONY") iPenalty=150;
|
||||
if (sItemTag=="GEM_POLISHED_CHRYSOPRASE") iPenalty=160;
|
||||
if (sItemTag=="GEM_POLISHED_CITRINE") iPenalty=170;
|
||||
if (sItemTag=="GEM_POLISHED_JASPER") iPenalty=180;
|
||||
if (sItemTag=="GEM_POLISHED_MOONSTONE") iPenalty=190;
|
||||
if (sItemTag=="GEM_POLISHED_ONYX") iPenalty=200;
|
||||
if (sItemTag=="GEM_POLISHED_ROCKCRYSTAL") iPenalty=210;
|
||||
if (sItemTag=="GEM_POLISHED_SARDONYX") iPenalty=220;
|
||||
if (sItemTag=="GEM_POLISHED_SMOKYQUARTZ") iPenalty=230;
|
||||
if (sItemTag=="GEM_POLISHED_STARROSEQUARTZ") iPenalty=240;
|
||||
if (sItemTag=="GEM_POLISHED_ZIRCON") iPenalty=250;
|
||||
//
|
||||
if (sItemTag=="GEM_POLISHED_AMBER") iPenalty=260;
|
||||
if (sItemTag=="GEM_POLISHED_ALEXANDRITE") iPenalty=270;
|
||||
if (sItemTag=="GEM_POLISHED_AMETHYST") iPenalty=280;
|
||||
if (sItemTag=="GEM_POLISHED_CHRYSOBERYL") iPenalty=290;
|
||||
if (sItemTag=="GEM_POLISHED_CORAL") iPenalty=300;
|
||||
if (sItemTag=="GEM_POLISHED_GARNET_RED") iPenalty=310;
|
||||
if (sItemTag=="GEM_POLISHED_JADE") iPenalty=320;
|
||||
if (sItemTag=="GEM_POLISHED_JET") iPenalty=330;
|
||||
if (sItemTag=="GEM_POLISHED_WHITEPEARL") iPenalty=340;
|
||||
if (sItemTag=="GEM_POLISHED_REDSPINEL") iPenalty=350;
|
||||
if (sItemTag=="GEM_POLISHED_TOURMALINE") iPenalty=360;
|
||||
//
|
||||
if (sItemTag=="GEM_POLISHED_AQUAMARINE") iPenalty=370;
|
||||
if (sItemTag=="GEM_POLISHED_GARNET_VIOLET") iPenalty=380;
|
||||
if (sItemTag=="GEM_POLISHED_BLACKPEARL") iPenalty=390;
|
||||
if (sItemTag=="GEM_POLISHED_PERIDOT") iPenalty=400;
|
||||
if (sItemTag=="GEM_POLISHED_BLUESPINEL") iPenalty=410;
|
||||
if (sItemTag=="GEM_POLISHED_TOPAZ") iPenalty=420;
|
||||
//
|
||||
if (sItemTag=="GEM_POLISHED_BLACKOPAL") iPenalty=430;
|
||||
if (sItemTag=="GEM_POLISHED_EMERALD") iPenalty=440;
|
||||
if (sItemTag=="GEM_POLISHED_FIREOPAL") iPenalty=450;
|
||||
if (sItemTag=="GEM_POLISHED_OPAL") iPenalty=460;
|
||||
if (sItemTag=="GEM_POLISHED_ORIENTALAMETHYST") iPenalty=470;
|
||||
if (sItemTag=="GEM_POLISHED_ORIENTALTOPAZ") iPenalty=480;
|
||||
if (sItemTag=="GEM_POLISHED_SAPPHIRE") iPenalty=490;
|
||||
if (sItemTag=="GEM_POLISHED_STARRUBY") iPenalty=500;
|
||||
if (sItemTag=="GEM_POLISHED_STARSAPPHIRE") iPenalty=510;
|
||||
//
|
||||
if (sItemTag=="GEM_POLISHED_BLACKSAPPHIRE") iPenalty=520;
|
||||
if (sItemTag=="GEM_POLISHED_DIAMOND") iPenalty=530;
|
||||
if (sItemTag=="GEM_POLISHED_JACINTH") iPenalty=540;
|
||||
if (sItemTag=="GEM_POLISHED_ORIENTALEMERALD") iPenalty=550;
|
||||
if (sItemTag=="GEM_POLISHED_RUBY") iPenalty=560;
|
||||
|
||||
iGemChance = iGemChance - iPenalty;
|
||||
|
||||
if (iGemChance<1)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have the skill needed to work with this gem.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(15.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
SetLocalInt(oPC,"iAmDigging",99);
|
||||
DelayCommand(15.1,SetLocalInt(oPC,"iAmDigging",0));
|
||||
AssignCommand(oPC,DelayCommand(0.1,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,3.0)));
|
||||
AssignCommand(oPC,DelayCommand(3.1,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,3.0)));
|
||||
AssignCommand(oPC,DelayCommand(6.1,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,3.0)));
|
||||
AssignCommand(oPC,DelayCommand(9.1,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,3.0)));
|
||||
AssignCommand(oPC,DelayCommand(12.1,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,3.0)));
|
||||
|
||||
// This snippet of code is cut-n-paste direct from ATS
|
||||
// Reason for this is because I had no clue how to assign an increase
|
||||
// in the z-axis of the location of the anvil for sparks to display.
|
||||
// After reading through this code, it is obvious that vEffecrPos.z
|
||||
// is the line which assigns this. Due to my own ignorance in this issue
|
||||
// I have decided to leave this snippet of code intact with this credit to
|
||||
// the original ATS script coders, whomever they may have been.
|
||||
// The only modification to this code is locAnvil was changed to locBath.
|
||||
|
||||
location locBath = GetLocation(OBJECT_SELF);
|
||||
vector vEffectPos = GetPositionFromLocation(locBath);
|
||||
vEffectPos.z += 1.5;
|
||||
location locEffect = Location( GetAreaFromLocation(locBath), vEffectPos,GetFacingFromLocation(locBath) );
|
||||
|
||||
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect);
|
||||
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_WHITE), locEffect);
|
||||
DelayCommand(0.1,PlaySound("as_cv_chiseling1"));
|
||||
DelayCommand(2.9,PlaySound("as_cv_chiseling3"));
|
||||
DelayCommand(8.8,PlaySound("as_cv_chiseling3"));
|
||||
DelayCommand(0.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(1.2,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(2.1,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(2.8,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(3.2,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(3.8,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(4.1,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(4.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(5.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(6.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(6.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(7.2,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(7.9,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(8.4,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(9.2,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(9.7,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(10.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(10.9,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(11.4,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(12.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(12.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(13.1,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(13.7,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(14.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(14.7,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(15.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(16.1,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
DelayCommand(16.7,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect));
|
||||
|
||||
//Adding a check for a null resref due to dividing a stack
|
||||
if (sItemResRef =="")
|
||||
{
|
||||
oItem = GetItemPossessedBy(OBJECT_SELF,sItemTag);
|
||||
sItemResRef = GetStringLeft(GetStringRight(sItemTag,GetStringLength(sItemTag)-13), 13) +"002";
|
||||
}
|
||||
|
||||
int iStackGems = GetNumStackedItems(oItem)-1;
|
||||
if (iStackGems>0) DelayCommand(1.0,CreateAnObject(sItemResRef,oPC,iStackGems));
|
||||
//SendMessageToPC(oPC,sItemResRef);
|
||||
int iSuccess = 0;
|
||||
if (Random(1000)<=iGemChance) iSuccess++;
|
||||
if (Random(1000)<=iGemChance) iSuccess++;
|
||||
if (Random(1000)<=iGemChance) iSuccess++;
|
||||
|
||||
string sGemResRef = GetStringLeft(sItemResRef,GetStringLength(sItemResRef)-1);
|
||||
string sPowderResRef = sGemResRef+"5";
|
||||
switch (iSuccess)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
DelayCommand(16.0,FloatingTextStringOnCreature("the gem is completely ruined by your attempt to cut it.",oPC,FALSE));
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
DelayCommand(16.0,FloatingTextStringOnCreature("You barely manage to cut the gem, producing a poor quality cut gem.",oPC,FALSE));
|
||||
sGemResRef = sGemResRef+"4";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
DelayCommand(16.0,FloatingTextStringOnCreature("With an expert hand you produce the highest quality cut gem.",oPC,FALSE));
|
||||
sGemResRef = GetStringLeft(sItemResRef,GetStringLength(sItemResRef)-3);
|
||||
|
||||
if (GetStringLeft (sGemResRef, 11) == "starrosequa") sGemResRef = "starrosequartz";
|
||||
|
||||
if (GetStringLeft (sGemResRef, 11) == "orientalame") sGemResRef = "orientalamethyst";
|
||||
|
||||
if (GetStringLeft (sGemResRef, 11) == "orientaleme") sGemResRef = "orientalemerald";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DelayCommand(16.0,FloatingTextStringOnCreature("You successfully cut the gem, producing an average quality cut gem.",oPC,FALSE));
|
||||
sGemResRef = sGemResRef+"3";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Random(1000)<=iGemChance)
|
||||
{
|
||||
DelayCommand(17.0,FloatingTextStringOnCreature("You carefully gather the fine powder that is left over.",oPC,FALSE));
|
||||
DelayCommand(16.5,CreateAnObject(sPowderResRef,oPC,1));
|
||||
}
|
||||
DelayCommand(17.1,CreateAnObject(sGemResRef,oPC,1));
|
||||
|
||||
int iSkillGain = 0;
|
||||
if (iSuccess>0)
|
||||
{
|
||||
if (Random(1000) >= iGemSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iGemChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iGemSkill++;
|
||||
sOldSkill2 = IntToString(iGemSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iGemSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iGemSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(17.0,SetTokenPair(oPC,13,7,iGemSkill));
|
||||
DelayCommand(17.0,SetPersistentInt(oPC,"iGemSkill",iGemSkill,0,"UOACraft"));
|
||||
DelayCommand(17.0,SendMessageToPC(oPC,"======================================"));
|
||||
DelayCommand(17.0,SendMessageToPC(oPC,"Your skill in gem cutting has gone up!"));
|
||||
DelayCommand(17.0,SendMessageToPC(oPC,"Current gem cutting skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(17.0,SendMessageToPC(oPC,"======================================"));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(16.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
324
_module/nss/_craft_gempolish.nss
Normal file
324
_module/nss/_craft_gempolish.nss
Normal file
@@ -0,0 +1,324 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sItemResRef = GetResRef(oItem);
|
||||
string sSuccess = "";
|
||||
string sName = GetName(oItem);
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
|
||||
|
||||
if (GetStringLeft(sItemTag,10)!="GEM_ROUGH_")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("This is not a rough gemstone...",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("The tumbler is not yet ready for more gemstones...",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
object oGrit1 = GetItemPossessedBy(oPC,"GRIT_COARSE");
|
||||
object oGrit2 = GetItemPossessedBy(oPC,"GRIT_MEDIUM");
|
||||
object oGrit3 = GetItemPossessedBy(oPC,"GRIT_FINE");
|
||||
int iGrit1 = GetNumStackedItems(oGrit1)-1;
|
||||
int iGrit2 = GetNumStackedItems(oGrit2)-1;
|
||||
int iGrit3 = GetNumStackedItems(oGrit3)-1;
|
||||
|
||||
//SendMessageToPC(oPC,"Coarse Grit ResRef : "+GetResRef(oGrit1));
|
||||
//SendMessageToPC(oPC,"Medium Grit ResRef : "+GetResRef(oGrit2));
|
||||
//SendMessageToPC(oPC," Fine Grit ResRef : "+GetResRef(oGrit3));
|
||||
//SendMessageToPC(oPC,"Coarse Grit Tag : "+GetTag(oGrit1));
|
||||
//SendMessageToPC(oPC,"Medium Grit Tag : "+GetTag(oGrit2));
|
||||
//SendMessageToPC(oPC," Fine Grit Tag : "+GetTag(oGrit3));
|
||||
//SendMessageToPC(oPC,"Coarse Grit Stack : "+IntToString(iGrit1));
|
||||
//SendMessageToPC(oPC,"Medium Grit Stack : "+IntToString(iGrit2));
|
||||
//SendMessageToPC(oPC," Fine Grit Stack : "+IntToString(iGrit3));
|
||||
|
||||
|
||||
|
||||
|
||||
if (oGrit1 == OBJECT_INVALID)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You must have some coarse polishing grit in order to begin polishing gems.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
if (oGrit2 == OBJECT_INVALID)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You must have some medium polishing grit in order to continue the gem polishing process.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
if (oGrit3 == OBJECT_INVALID)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You must have some fine polishing grit in order to finish the gem polishing process.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
//This line added June 3, 2003 and will check for a split stack,
|
||||
//which has no ResRef, and find the other half of the stack that
|
||||
//actually has the ResRef.
|
||||
if (sItemResRef=="") sItemResRef = GetResRef(GetItemPossessedBy(oPC,GetTag(oItem)));
|
||||
|
||||
DestroyObject(oGrit1,0.1);
|
||||
DestroyObject(oGrit2,0.2);
|
||||
DestroyObject(oGrit3,0.3);
|
||||
|
||||
//***IMPORTANT NOTE****
|
||||
//The delay for the 1st creation of 'grit001' is required in order to
|
||||
//prevent an interesting bug in order of execution of creation/destruction of
|
||||
//stacked items.
|
||||
//Without the delay, the script runs properly 1st time through.. but behind the scenes
|
||||
//you temporarily have 2 items.. a stack of 10 and a stack of 9.. total of 19
|
||||
//it then destroys the stack of 10, leaving you with 9. The second time through
|
||||
//however, it creates 8, giving you a stack of 10 and a stack of 7. It then
|
||||
//destroys the stack of 10, leaving you with 7. Big error as you should have 8.
|
||||
|
||||
if (iGrit1 >0) DelayCommand(1.0,CreateAnObject("grit001",oPC,iGrit1));
|
||||
if (iGrit2 >0) DelayCommand(10.1,CreateAnObject("grit002",oPC,iGrit2));
|
||||
if (iGrit3 >0) DelayCommand(20.1,CreateAnObject("grit003",oPC,iGrit3));
|
||||
|
||||
FloatingTextStringOnCreature("You begin polishing the "+GetName(oItem)+"...",oPC,FALSE);
|
||||
DelayCommand(10.0,FloatingTextStringOnCreature("You begin the second polishing cycle...",oPC,FALSE));
|
||||
DelayCommand(20.0,FloatingTextStringOnCreature("You begin the third, and final, polishing cycle.",oPC,FALSE));
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(30.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
|
||||
// This snippet of code is cut-n-paste direct from ATS
|
||||
// Reason for this is because I had no clue how to assign an increase
|
||||
// in the z-axis of the location of the anvil for sparks to display.
|
||||
// After reading through this code, it is obvious that vEffecrPos.z
|
||||
// is the line which assigns this. Due to my own ignorance in this issue
|
||||
// I have decided to leave this snippet of code intact with this credit to
|
||||
// the original ATS script coders, whomever they may have been.
|
||||
// The only modification to this code is locAnvil was changed to locBath.
|
||||
|
||||
location locBath = GetLocation(OBJECT_SELF);
|
||||
vector vEffectPos = GetPositionFromLocation(locBath);
|
||||
vEffectPos.z += 0.8;
|
||||
location locEffect = Location( GetAreaFromLocation(locBath), vEffectPos,GetFacingFromLocation(locBath) );
|
||||
|
||||
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), locEffect);
|
||||
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect);
|
||||
DelayCommand(0.1,PlaySound("al_cv_millwheel"));
|
||||
DelayCommand(6.0,PlaySound("al_cv_millwheel"));
|
||||
DelayCommand(12.0,PlaySound("al_cv_millwheel"));
|
||||
DelayCommand(18.0,PlaySound("al_cv_millwheel"));
|
||||
DelayCommand(24.0,PlaySound("al_cv_millwheel"));
|
||||
DelayCommand(0.2,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(6.1,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(12.1,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(18.1,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(24.1,PlaySound("al_cv_fanlg1"));
|
||||
|
||||
DelayCommand(0.4,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(0.4,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(0.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_WHITE), locEffect));
|
||||
DelayCommand(1.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_BLUE_RED), locEffect));
|
||||
DelayCommand(1.8,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(2.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE), locEffect));
|
||||
DelayCommand(3.3,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(3.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(4.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_WHITE), locEffect));
|
||||
DelayCommand(4.8,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(5.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_WHITE_ORANGE), locEffect));
|
||||
DelayCommand(6.2,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(6.2,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(7.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_PINK_ORANGE), locEffect));
|
||||
DelayCommand(7.8,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(8.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_WHITE), locEffect));
|
||||
DelayCommand(9.1,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(9.1,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(9.8,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_PINK_ORANGE), locEffect));
|
||||
DelayCommand(10.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(11.4,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_BLUE_RED), locEffect));
|
||||
DelayCommand(12.0,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(12.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(12.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(13.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE), locEffect));
|
||||
DelayCommand(14.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(14.9,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(14.9,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(15.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_PINK_ORANGE), locEffect));
|
||||
DelayCommand(16.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(17.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_WHITE_ORANGE), locEffect));
|
||||
DelayCommand(17.8,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(17.8,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(18.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_BLUE_RED), locEffect));
|
||||
DelayCommand(19.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(20.0,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE), locEffect));
|
||||
DelayCommand(20.7,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(20.7,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(21.4,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE), locEffect));
|
||||
DelayCommand(22.2,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(22.9,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_PINK_ORANGE), locEffect));
|
||||
DelayCommand(23.6,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(23.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(24.4,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_WHITE), locEffect));
|
||||
DelayCommand(25.2,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(25.9,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE), locEffect));
|
||||
DelayCommand(26.5,PlaySound("al_mg_jacobs1"));
|
||||
DelayCommand(26.5,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ACID), locEffect));
|
||||
DelayCommand(27.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE), locEffect));
|
||||
DelayCommand(28.3,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
|
||||
DelayCommand(29.6,ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE), locEffect));
|
||||
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,8.5));
|
||||
AssignCommand(oPC,DelayCommand(10.1,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,8.5)));
|
||||
AssignCommand(oPC,DelayCommand(20.1,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,8.5)));
|
||||
|
||||
int iItem = GetNumStackedItems(oItem);
|
||||
|
||||
//int iPolishSkill = GetTokenPair(oPC,13,6);
|
||||
int iPolishSkill = GetPersistentInt(oPC,"iPolishSkill","UOACraft");
|
||||
int iPolishChance = iPolishSkill;
|
||||
if (iPolishChance <350)
|
||||
{
|
||||
iPolishChance = GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*4;
|
||||
iPolishChance = iPolishChance+(GetAbilityScore(oPC,ABILITY_WISDOM)*4);
|
||||
iPolishChance = iPolishChance+(GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
|
||||
iPolishChance = iPolishChance*3;
|
||||
if (iPolishChance>350) iPolishChance = 350;
|
||||
if (iPolishChance<iPolishSkill) iPolishChance = iPolishSkill;
|
||||
}
|
||||
|
||||
int iSuccess = 0;
|
||||
if (Random(1000)<=iPolishChance) iSuccess++;
|
||||
if (Random(1000)<=iPolishChance) iSuccess++;
|
||||
if (Random(1000)<=(iPolishChance-500)) iSuccess++;
|
||||
|
||||
string sGemResRef = GetStringLeft(sItemResRef,GetStringLength(sItemResRef)-1);
|
||||
switch (iSuccess)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
DelayCommand(29.5,FloatingTextStringOnCreature("Your attempt to polish this gem fails completely. The gem is lost.",oPC,FALSE));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
DelayCommand(29.5,FloatingTextStringOnCreature("You tumble the gem for too long, and it is reduced to powder..",oPC,FALSE));
|
||||
DelayCommand(31.1,CreateAnObject(sGemResRef+"5",oPC,1));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
DelayCommand(29.5,FloatingTextStringOnCreature("You successfully tumble the "+sName+ " and you recover some powder as well.",oPC,FALSE));
|
||||
DelayCommand(29.1,CreateAnObject(sGemResRef+"2",oPC,1));
|
||||
DelayCommand(31.1,CreateAnObject(sGemResRef+"5",oPC,1));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DelayCommand(29.5,FloatingTextStringOnCreature("You successfully tumble the "+sName+".",oPC,FALSE));
|
||||
DelayCommand(31.1,CreateAnObject(sGemResRef+"2",oPC,1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int iSkillGain = 0;
|
||||
if (iSuccess>0)
|
||||
{
|
||||
if (Random(1000) >= iPolishSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iPolishChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iPolishSkill++;
|
||||
sOldSkill2 = IntToString(iPolishSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iPolishSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iPolishSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(31.0,SetTokenPair(oPC,13,6,iPolishSkill));
|
||||
DelayCommand(31.0,SetPersistentInt(oPC,"iPolishSkill",iPolishSkill,0,"UOACraft"));
|
||||
DelayCommand(31.0,SendMessageToPC(oPC,"======================================="));
|
||||
DelayCommand(31.0,SendMessageToPC(oPC,"Your skill in gem polishing has gone up!"));
|
||||
DelayCommand(31.0,SendMessageToPC(oPC,"Current gem polishing skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(31.0,SendMessageToPC(oPC,"========================================"));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(30.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
// Only process 1 gem at a time. Return the rest of the stack to the PC.
|
||||
// The reason for this is due to the value of the gems a PC could make
|
||||
// too much gold too fast if allowed to process stacks at a time.
|
||||
|
||||
if (iItem >1)
|
||||
{
|
||||
iItem--;
|
||||
CreateItemOnObject(GetResRef(oItem),oPC,iItem);
|
||||
}
|
||||
|
||||
DestroyObject(oItem);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
23
_module/nss/_craft_hb_cook.nss
Normal file
23
_module/nss/_craft_hb_cook.nss
Normal file
@@ -0,0 +1,23 @@
|
||||
void main()
|
||||
{
|
||||
object oSelf=OBJECT_SELF;
|
||||
int iTimer = GetLocalInt(oSelf,"iLive");
|
||||
iTimer++;
|
||||
SetLocalInt(oSelf,"iLive",iTimer);
|
||||
if (iTimer>50)
|
||||
{
|
||||
//Chance to start a fire goes here
|
||||
//
|
||||
DestroyObject(oSelf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetIsNight()==TRUE)
|
||||
{
|
||||
//Chance to attaract an animal
|
||||
}
|
||||
|
||||
PlaySound("al_cv_firebowl1");
|
||||
if (Random(1000)<100) PlaySound("as_na_rockfalsm2");
|
||||
|
||||
}
|
1301
_module/nss/_craft_jeweler.nss
Normal file
1301
_module/nss/_craft_jeweler.nss
Normal file
File diff suppressed because it is too large
Load Diff
420
_module/nss/_craft_juice.nss
Normal file
420
_module/nss/_craft_juice.nss
Normal file
@@ -0,0 +1,420 @@
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC);
|
||||
|
||||
void main()
|
||||
{
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
if (GetLastDisturbed() == OBJECT_SELF)
|
||||
{
|
||||
DestroyObject(GetInventoryDisturbItem());
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this mill may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
SendMessageToPC(oPC,"You must wait until the press is done before starting another batch.");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sProduct = "INVALID";
|
||||
int iDifficulty = 0;
|
||||
int iRandom;
|
||||
int iSkillGain;
|
||||
int iGlassType=0;
|
||||
location lFire = GetLocation(OBJECT_SELF);
|
||||
string sSuccess = "You have successfully pressed the "+GetName(oItem)+" into juice.";
|
||||
string sFail = "The juice is contaminated and unuseable.";
|
||||
|
||||
if (sItemTag=="ITEM_YELLOWAPPLE") //Apple Juice
|
||||
{
|
||||
sProduct = "item_juice_001";
|
||||
iDifficulty=150;
|
||||
}
|
||||
if (sItemTag=="ITEM_GREENAPPLE") //Apple Juice
|
||||
{
|
||||
sProduct = "item_juice_001";
|
||||
iDifficulty=150;
|
||||
}
|
||||
if (sItemTag=="ITEM_REDAPPLE") //Apple Juice
|
||||
{
|
||||
sProduct = "item_juice_001";
|
||||
iDifficulty=150;
|
||||
}
|
||||
if (sItemTag=="SEED_CARROT") //Juice
|
||||
{
|
||||
sProduct = "item_juice_002";
|
||||
iDifficulty=100;
|
||||
}
|
||||
if (sItemTag=="SEED_GRAPE1") //Juice
|
||||
{
|
||||
sProduct = "item_juice_003";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="SEED_GRAPE2") //Juice
|
||||
{
|
||||
sProduct = "item_juice_004";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="SEED_GRAPE3") //Juice
|
||||
{
|
||||
sProduct = "item_juice_005";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="SEED_BLACKBERRY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_006";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="SEED_BLUEBERRY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_007";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="SEED_CELERY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_008";
|
||||
iDifficulty=100;
|
||||
}
|
||||
if (sItemTag=="ITEM_CHERRY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_009";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="ITEM_COCONUT") //Juice
|
||||
{
|
||||
sProduct = "item_juice_010";
|
||||
sSuccess = "You have successfully pressed the milk from the "+GetName(oItem)+".";
|
||||
sFail = "The milk is contaminated and unuseable.";
|
||||
iDifficulty=150;
|
||||
}
|
||||
if (sItemTag=="SEED_CRANBERRY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_011";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="ITEM_DATE") //Juice
|
||||
{
|
||||
sProduct = "item_juice_012";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="ITEM_ELDERBERRY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_013";
|
||||
iDifficulty=-50;
|
||||
}
|
||||
if (sItemTag=="ITEM_FIG") //Juice
|
||||
{
|
||||
sProduct = "item_juice_014";
|
||||
iDifficulty=100;
|
||||
}
|
||||
if (sItemTag=="SEED_GOOSEBERRY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_015";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="ITEM_GRAPEFRUIT") //Juice
|
||||
{
|
||||
sProduct = "item_juice_016";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="SEED_JUNIPERBERRY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_017";
|
||||
iDifficulty=150;
|
||||
}
|
||||
if (sItemTag=="ITEM_KIWI") //Juice
|
||||
{
|
||||
sProduct = "item_juice_018";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="ITEM_LEMON") //Juice
|
||||
{
|
||||
sProduct = "item_juice_019";
|
||||
iDifficulty=-100;
|
||||
}
|
||||
if (sItemTag=="ITEM_FRUITLIME") //Juice
|
||||
{
|
||||
sProduct = "item_juice_020";
|
||||
iDifficulty=-100;
|
||||
}
|
||||
if (sItemTag=="ITEM_MANGO") //Juice
|
||||
{
|
||||
sProduct = "item_juice_021";
|
||||
iDifficulty=-50;
|
||||
}
|
||||
if (sItemTag=="SEED_MAYAPPLE") //Juice
|
||||
{
|
||||
sProduct = "item_juice_022";
|
||||
iDifficulty=100;
|
||||
}
|
||||
if (sItemTag=="ITEM_ORANGE") //Juice
|
||||
{
|
||||
sProduct = "item_juice_023";
|
||||
iDifficulty=-200;
|
||||
}
|
||||
if (sItemTag=="ITEM_PEAR") //Juice
|
||||
{
|
||||
sProduct = "item_juice_024";
|
||||
iDifficulty=-50;
|
||||
}
|
||||
if (sItemTag=="ITEM_PLUM") //Juice
|
||||
{
|
||||
sProduct = "item_juice_025";
|
||||
iDifficulty=-100;
|
||||
}
|
||||
if (sItemTag=="SEED_RASPBERRY") //Juice
|
||||
{
|
||||
sProduct = "item_juice_026";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="ITEM_TANGERINE") //Juice
|
||||
{
|
||||
sProduct = "item_juice_027";
|
||||
iDifficulty=-100;
|
||||
}
|
||||
if (sItemTag=="SEED_TOMATO") //Juice
|
||||
{
|
||||
sProduct = "item_juice_028";
|
||||
iDifficulty=-150;
|
||||
}
|
||||
if (sItemTag=="SEED_TURNIP") //Juice
|
||||
{
|
||||
sProduct = "item_juice_029";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="SEED_BEETS") //Juice
|
||||
{
|
||||
sProduct = "item_juice_030";
|
||||
iDifficulty=100;
|
||||
}
|
||||
if (sItemTag=="SEED_SUGARCANE") //Juice
|
||||
{
|
||||
sProduct = "item_juice_031";
|
||||
sSuccess = "You have successfully extracted the fluids from the "+GetName(oItem)+".";
|
||||
sFail = "The extract is contaminated and unuseable.";
|
||||
iDifficulty=300;
|
||||
}
|
||||
if (sItemTag=="ITEM_WATERMELON") //Juice
|
||||
{
|
||||
sProduct = "item_juice_032";
|
||||
iDifficulty=-200;
|
||||
}
|
||||
if (sItemTag=="ITEM_ALMOND") //Juice
|
||||
{
|
||||
sProduct = "item_juice_033";
|
||||
sSuccess = "You have successfully pressed the oil from the "+GetName(oItem)+".";
|
||||
sFail = "The oil is contaminated and unuseable.";
|
||||
iGlassType=1;
|
||||
iDifficulty=250;
|
||||
}
|
||||
if (sItemTag=="SEED_GARLIC") //Juice
|
||||
{
|
||||
sProduct = "item_juice_034";
|
||||
sSuccess = "You have successfully pressed the oil from the "+GetName(oItem)+".";
|
||||
sFail = "The oil is contaminated and unuseable.";
|
||||
iGlassType=1;
|
||||
iDifficulty=250;
|
||||
}
|
||||
if (sItemTag=="SEED_CORN") //Juice
|
||||
{
|
||||
sProduct = "item_juice_035";
|
||||
sSuccess = "You have successfully pressed the oil from the "+GetName(oItem)+".";
|
||||
sFail = "The oil is contaminated and unuseable.";
|
||||
iGlassType=1;
|
||||
iDifficulty=200;
|
||||
}
|
||||
if (sItemTag=="SEED_COTTON") //Juice
|
||||
{
|
||||
sProduct = "item_juice_036";
|
||||
sSuccess = "You have successfully pressed the oil from the "+GetName(oItem)+".";
|
||||
sFail = "The oil is contaminated and unuseable.";
|
||||
iGlassType=1;
|
||||
iDifficulty=150;
|
||||
}
|
||||
if (sItemTag=="ITEM_OLIVE") //Juice
|
||||
{
|
||||
sProduct = "item_juice_037";
|
||||
sSuccess = "You have successfully pressed the oil from the "+GetName(oItem)+".";
|
||||
sFail = "The oil is contaminated and unuseable.";
|
||||
iGlassType=1;
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="SEED_PEANUTS") //Juice
|
||||
{
|
||||
sProduct = "item_juice_038";
|
||||
sSuccess = "You have successfully pressed the oil from the "+GetName(oItem)+".";
|
||||
sFail = "The oil is contaminated and unuseable.";
|
||||
iGlassType=1;
|
||||
iDifficulty=100;
|
||||
}
|
||||
if (sItemTag=="ITEM_PECAN") //Juice
|
||||
{
|
||||
sProduct = "item_juice_039";
|
||||
sSuccess = "You have successfully pressed the oil from the "+GetName(oItem)+".";
|
||||
sFail = "The oil is contaminated and unuseable.";
|
||||
iGlassType=1;
|
||||
iDifficulty=150;
|
||||
}
|
||||
if (sItemTag=="ITEM_WALNUT") //Juice
|
||||
{
|
||||
sProduct = "item_juice_040";
|
||||
sSuccess = "You have successfully pressed the oil from the "+GetName(oItem)+".";
|
||||
sFail = "The oil is contaminated and unuseable.";
|
||||
iGlassType=1;
|
||||
iDifficulty=150;
|
||||
}
|
||||
|
||||
if (sProduct=="INVALID")
|
||||
{
|
||||
SendMessageToPC(oPC,"You may not press this object into any form of juice!");
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
object oGlass;
|
||||
if (iGlassType==0)
|
||||
{
|
||||
oGlass = GetItemPossessedBy(oPC,"ITEM_GLASSBOTTLE");
|
||||
if (oGlass==OBJECT_INVALID)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have an empty glass bottle to collect juices.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oGlass = GetItemPossessedBy(oPC,"ITEM_GLASSVIAL");
|
||||
if (oGlass==OBJECT_INVALID)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have an empty glass vial to extract oils.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//DestroyObject(oGlass,0.1);
|
||||
|
||||
int iCookSkill = GetPersistentInt(oPC,"iCookSkill","UOACraft");
|
||||
int iCookChance = iCookSkill;
|
||||
|
||||
if (iCookChance<350)
|
||||
{
|
||||
iCookChance = GetAbilityScore(oPC,ABILITY_WISDOM)*5;
|
||||
iCookChance = iCookChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
|
||||
iCookChance = iCookChance+(GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
|
||||
iCookChance = iCookChance*3;
|
||||
if (iCookChance>350)iCookChance=350;
|
||||
if (iCookSkill > iCookChance) iCookChance=iCookSkill;
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(6.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
DestroyObject(oItem,0.1);
|
||||
|
||||
iCookChance = iCookChance-iDifficulty;
|
||||
if (iCookChance<1)iCookChance=1;
|
||||
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,6.0));
|
||||
PlaySound("al_cv_pump");
|
||||
DelayCommand(1.0,PlaySound("as_na_steamlong2"));
|
||||
DelayCommand(3.0,PlaySound("al_cv_pump"));
|
||||
DelayCommand(0.5,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF),lFire));
|
||||
DelayCommand(2.5,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF),lFire));
|
||||
DelayCommand(4.5,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF),lFire));
|
||||
|
||||
iRandom = Random(1000)+Random(1000)+Random(800);//Adjusted difficulty downwards by a small percent to make lowlevel cooks succeed a bit more.
|
||||
iRandom = iRandom/3;
|
||||
if (iRandom<=iCookChance)
|
||||
{
|
||||
if (Random(1000) >= iCookSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iCookChance/100) iSkillGain = 1;
|
||||
}
|
||||
DestroyObject(oGlass,5.1);
|
||||
DelayCommand(4.5,AssignCommand(oPC,PlaySound("as_na_steamshrt2")));
|
||||
DelayCommand(5.5,PlaySound("as_na_splash2"));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(6.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(6.1,CreateAnObject(sProduct,oPC)));
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(GetArea(oPC),DelayCommand(6.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
||||
DelayCommand(4.0,AssignCommand(oPC,PlaySound("as_cv_pipeflush3")));
|
||||
return;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iCookSkill++;
|
||||
sOldSkill2 = IntToString(iCookSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iCookSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iCookSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(13.0,SetTokenPair(oPC,13,3,iCookSkill));
|
||||
DelayCommand(6.5,SetPersistentInt(oPC,"iCookSkill",iCookSkill,0,"UOACraft"));
|
||||
DelayCommand(6.5,SendMessageToPC(oPC,"=================================="));
|
||||
DelayCommand(6.5,SendMessageToPC(oPC,"Your skill in cooking has gone up!"));
|
||||
DelayCommand(6.5,SendMessageToPC(oPC,"Current cooking skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(6.5,SendMessageToPC(oPC,"=================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(6.4,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,1);
|
||||
return;
|
||||
}
|
491
_module/nss/_craft_kiln.nss
Normal file
491
_module/nss/_craft_kiln.nss
Normal file
@@ -0,0 +1,491 @@
|
||||
//#include "_persist_01a"
|
||||
#include "nw_i0_plot"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC);
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration);
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
int iAdded = 0;
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
iAdded =99;
|
||||
|
||||
object oTemp = OBJECT_INVALID;
|
||||
object oSelf = OBJECT_SELF;
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItem = GetTag(oItem);
|
||||
string sItemResRef = GetResRef(oItem);
|
||||
int iHaveAllParts = 0;
|
||||
int iCreated = 1;
|
||||
int iInvalidItem = 0;
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must wait until the kiln is at the right temprature before starting any other item.",oPC,FALSE);
|
||||
if (iAdded != 99)CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sItem == "ITEM_SAND")iInvalidItem = 99;
|
||||
if (GetStringLeft(sItemResRef,7) == "pattern") iInvalidItem = 99;
|
||||
|
||||
|
||||
if (iInvalidItem==0)
|
||||
{
|
||||
FloatingTextStringOnCreature("You cannot fire this in a kiln to create anything useful.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (iAdded == 99)
|
||||
{
|
||||
CopyObject(oItem,GetLocation(OBJECT_SELF),OBJECT_SELF,GetTag(oItem));
|
||||
if (GetItemPossessedBy(oPC,"TinkersToolset")==OBJECT_INVALID) iHaveAllParts = 99;
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="002")
|
||||
{
|
||||
if (GetItemPossessedBy(oPC,"ITEM_CLAY")==OBJECT_INVALID) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_CLAY");
|
||||
DestroyObject(oTemp);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="074") //Ring Mold
|
||||
{
|
||||
if (GetItemPossessedBy(oPC,"ITEM_CLAY")==OBJECT_INVALID) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_CLAY");
|
||||
DestroyObject(oTemp);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="098") //Necklace Mold
|
||||
{
|
||||
if (GetItemPossessedBy(oPC,"ITEM_CLAY")==OBJECT_INVALID) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_CLAY");
|
||||
DestroyObject(oTemp);
|
||||
}
|
||||
}
|
||||
if (GetStringRight(sItemResRef,3)=="099") //Amulet Mold
|
||||
{
|
||||
if (GetItemPossessedBy(oPC,"ITEM_CLAY")==OBJECT_INVALID) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_CLAY");
|
||||
DestroyObject(oTemp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="003")
|
||||
{
|
||||
if (GetNumItems(oPC,"ITEM_CLAY")<2) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_CLAY");
|
||||
DestroyObject(oTemp);
|
||||
DelayCommand(3.0,GetNextItemPossessedBy(oPC,"ITEM_CLAY"));
|
||||
}
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="004")
|
||||
{
|
||||
if (GetNumItems(oPC,"ITEM_CLAY")<3) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_CLAY");
|
||||
DestroyObject(oTemp);
|
||||
DelayCommand(3.0,GetNextItemPossessedBy(oPC,"ITEM_CLAY"));
|
||||
DelayCommand(6.0,GetNextItemPossessedBy(oPC,"ITEM_CLAY"));
|
||||
}
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="010")
|
||||
{
|
||||
if (GetNumItems(oPC,"INGOT_GLASS")==0) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"INGOT_GLASS");
|
||||
DestroyObject(oTemp);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="113")
|
||||
{
|
||||
if (GetNumItems(oPC,"INGOT_GLASS")==0) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"INGOT_GLASS");
|
||||
DestroyObject(oTemp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="011")
|
||||
{
|
||||
if (GetNumItems(oPC,"INGOT_GLASS")==0) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"INGOT_GLASS");
|
||||
DestroyObject(oTemp);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="122") //cider jug
|
||||
{
|
||||
if (GetNumItems(oPC,"INGOT_GLASS")<2) iHaveAllParts = 99;
|
||||
if (iHaveAllParts == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"INGOT_GLASS");
|
||||
DestroyObject(oTemp);
|
||||
DelayCommand(3.0,GetNextItemPossessedBy(oPC,"INGOT_GLASS"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (iHaveAllParts == 99)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have all the parts required to craft this item.",oPC,FALSE);
|
||||
SendMessageToPC(oPC,"Examine the pattern before removing it to check what is required.");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
location lSelf = GetLocation(OBJECT_SELF);
|
||||
float fSelf = GetFacing(OBJECT_SELF);
|
||||
vector vSelf = GetPosition(OBJECT_SELF);
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
vFire = vSelf + (AngleToVector(fSelf) * 0.4);
|
||||
location lFire = Location(oArea,vFire,fSelf);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//int iGlassSkill = GetTokenPair(oPC,14,4);
|
||||
int iGlassSkill = GetPersistentInt(oPC,"iGlassSkill","UOACraft");
|
||||
int iGlassChance = iGlassSkill;
|
||||
object oFire = CreatePlaceable("plc_flamemedium", lFire, 6.0);
|
||||
|
||||
string sCraft = "";
|
||||
string sSuccessString = "";
|
||||
string sFailString = "";
|
||||
string sSoundSuccess = "";
|
||||
string sSoundFail = "";
|
||||
effect eSuccess;
|
||||
effect eFail;
|
||||
int iSuccessAnimation = 0;
|
||||
int iFailAnimation = 0;
|
||||
|
||||
if (iGlassChance <350)
|
||||
{
|
||||
iGlassChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*4;
|
||||
iGlassChance = iGlassChance+(GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*3);
|
||||
iGlassChance = iGlassChance+(GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iGlassChance = iGlassChance *3;
|
||||
if (iGlassChance > 350) iGlassChance = 350;
|
||||
if (iGlassSkill > iGlassChance) iGlassChance = iGlassSkill;
|
||||
}
|
||||
|
||||
AssignCommand(oPC,PlaySound("al_cv_firebowl1"));
|
||||
AssignCommand(oPC,PlaySound("as_cv_mineshovl1"));
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,4.0));
|
||||
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE,1.0,6.0);
|
||||
if (sItem == "ITEM_SAND")
|
||||
{
|
||||
if (iGlassChance < 250) iGlassChance = 0;
|
||||
sCraft = "glassingot";
|
||||
sSuccessString = "You melt the sand into a Glass Ingot";
|
||||
sFailString = "The glass turns murky, and the ingot shatters as it cools.";
|
||||
sSoundFail = "as_cv_glasbreak2";
|
||||
sSoundSuccess = "as_cv_barglass2";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
|
||||
if (iAdded ==99)
|
||||
{
|
||||
if (GetStringRight(sItemResRef,3)=="002")
|
||||
{
|
||||
iGlassChance = iGlassChance - 50;
|
||||
sCraft = "smallcastmold";
|
||||
sSuccessString = "You successfully glaze the small cast mold.";
|
||||
sFailString = "The clay turns brittle, and the mold shatters as it cools.";
|
||||
sSoundFail = "as_cv_claybreak3";
|
||||
sSoundSuccess = "as_cv_claybreak1";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="074")
|
||||
{
|
||||
iGlassChance = iGlassChance - 50;
|
||||
sCraft = "smallcastmold003";
|
||||
sSuccessString = "You successfully glaze the ring mold.";
|
||||
sFailString = "The clay turns brittle, and the mold shatters as it cools.";
|
||||
sSoundFail = "as_cv_claybreak3";
|
||||
sSoundSuccess = "as_cv_claybreak1";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
if (GetStringRight(sItemResRef,3)=="098") //necklace mold
|
||||
{
|
||||
iGlassChance = iGlassChance - 250;
|
||||
sCraft = "smallcastmold004";
|
||||
sSuccessString = "You successfully glaze the necklace mold.";
|
||||
sFailString = "The clay turns brittle, and the mold shatters as it cools.";
|
||||
sSoundFail = "as_cv_claybreak3";
|
||||
sSoundSuccess = "as_cv_claybreak1";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
if (GetStringRight(sItemResRef,3)=="099") //amulet mold
|
||||
{
|
||||
iGlassChance = iGlassChance - 350;
|
||||
sCraft = "smallcastmold005";
|
||||
sSuccessString = "You successfully glaze the amulet mold.";
|
||||
sFailString = "The clay turns brittle, and the mold shatters as it cools.";
|
||||
sSoundFail = "as_cv_claybreak3";
|
||||
sSoundSuccess = "as_cv_claybreak1";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
if (GetStringRight(sItemResRef,3)=="003")
|
||||
{
|
||||
iGlassChance = iGlassChance - 150;
|
||||
sCraft = "smallcastmold001";
|
||||
sSuccessString = "You successfully glaze the medium cast mold.";
|
||||
sFailString = "The clay turns brittle, and the mold shatters as it cools.";
|
||||
sSoundFail = "as_cv_claybreak3";
|
||||
sSoundSuccess = "as_cv_claybreak1";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
if (GetStringRight(sItemResRef,3)=="004")
|
||||
{
|
||||
iGlassChance = iGlassChance - 250;
|
||||
sCraft = "smallcastmold002";
|
||||
sSuccessString = "You successfully glaze the large cast mold.";
|
||||
sFailString = "The clay turns brittle, and the mold shatters as it cools.";
|
||||
sSoundFail = "as_cv_claybreak3";
|
||||
sSoundSuccess = "as_cv_claybreak1";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="010")
|
||||
{
|
||||
iGlassChance = iGlassChance - 75;
|
||||
sCraft = "glassvial";
|
||||
sSuccessString = "You successfully blow and shape the glass vial.";
|
||||
sFailString = "The vial turns murky, and shatters as it cools.";
|
||||
sSoundFail = "as_cv_glasbreak2";
|
||||
sSoundSuccess = "as_cv_barglass2";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="011")
|
||||
{
|
||||
iGlassChance = iGlassChance - 250;
|
||||
sCraft = "glassbottle";
|
||||
sSuccessString = "You successfully blow and shape the glass bottle.";
|
||||
sFailString = "The bottle turns murky, and shatters as it cools.";
|
||||
sSoundFail = "as_cv_glasbreak2";
|
||||
sSoundSuccess = "as_cv_barglass2";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="113")
|
||||
{
|
||||
iGlassChance = iGlassChance - 200;
|
||||
iCreated=2;
|
||||
sCraft = "yeastvial001";
|
||||
sSuccessString = "You successfully blow and shape the yeast vials.";
|
||||
sFailString = "The vials turn murky, and shatter as they cool.";
|
||||
sSoundFail = "as_cv_glasbreak2";
|
||||
sSoundSuccess = "as_cv_barglass2";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemResRef,3)=="122")
|
||||
{
|
||||
iGlassChance = iGlassChance - 400;
|
||||
sCraft = "item_cask_006";
|
||||
sSuccessString = "You successfully blow and shape the cider jug.";
|
||||
sFailString = "The jug turns murky, and shatters as it cools.";
|
||||
sSoundFail = "as_cv_glasbreak2";
|
||||
sSoundSuccess = "as_cv_barglass2";
|
||||
eFail = EffectVisualEffect(VFX_COM_BLOOD_SPARK_LARGE,FALSE);
|
||||
eSuccess = EffectVisualEffect(VFX_COM_HIT_FROST,FALSE);
|
||||
iSuccessAnimation = ANIMATION_LOOPING_TALK_PLEADING;
|
||||
iFailAnimation = ANIMATION_LOOPING_PAUSE_TIRED;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(7.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
//ensure at least 1 respawn 10 minutes after used...
|
||||
//this is to prevent a broken placeable that is used, with a 'in use' delay
|
||||
//which would cancel the respawn
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmSetToRespawn")!=99)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"iAmSetToRespawn",99);
|
||||
DelayCommand(600.0,ExecuteScript("_onclose_clear",OBJECT_SELF));
|
||||
}
|
||||
|
||||
|
||||
int iRandom = Random(1000);
|
||||
int iSuccess = 0;
|
||||
int iSkillGain = 0;
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
|
||||
if (iRandom <= iGlassChance)
|
||||
{
|
||||
iSuccess = 1;
|
||||
DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(iSuccessAnimation,1.0,1.0)));
|
||||
DelayCommand(6.0,CreateAnObject(sCraft,oPC));
|
||||
if (iCreated==2) DelayCommand(6.1,CreateAnObject(sCraft,oPC));
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature(sSuccessString,oPC,FALSE));
|
||||
DelayCommand(5.8,PlaySound(sSoundSuccess));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eSuccess,oSelf,2.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(iFailAnimation,1.0,1.0)));
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature(sFailString,oPC,FALSE));
|
||||
DelayCommand(6.0,PlaySound(sSoundFail));
|
||||
DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eFail,oSelf,2.0));
|
||||
}
|
||||
DelayCommand(6.0,DestroyObject(oItem));
|
||||
|
||||
if (iSuccess == 1)
|
||||
{
|
||||
iRandom = Random(1000);
|
||||
if (iRandom >= iGlassSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iGlassChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iGlassSkill++;
|
||||
sOldSkill2 = IntToString(iGlassSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iGlassSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iGlassSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(5.0,SetTokenPair(oPC,14,4,iGlassSkill));
|
||||
DelayCommand(6.0,SetPersistentInt(oPC,"iGlassSkill",iGlassSkill,0,"UOACraft"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"============================"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Your Kiln skill has gone up!"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Current Kiln skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"============================"));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(5.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,1);
|
||||
return;
|
||||
}
|
||||
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration)
|
||||
{
|
||||
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
||||
if (fDuration != 0.0)
|
||||
DestroyObject(oPlaceable,fDuration);
|
||||
return oPlaceable;
|
||||
}
|
||||
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
DestroyObject(oTemp);
|
||||
return;
|
||||
}
|
||||
|
236
_module/nss/_craft_lauter.nss
Normal file
236
_module/nss/_craft_lauter.nss
Normal file
@@ -0,0 +1,236 @@
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iProduct);
|
||||
|
||||
void main()
|
||||
{
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
if (GetLastDisturbed() == OBJECT_SELF)
|
||||
{
|
||||
DestroyObject(GetInventoryDisturbItem());
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this mill may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
SendMessageToPC(oPC,"You must wait until the lautering is complete before starting another batch.");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sProduct = "INVALID";
|
||||
int iProduct = 1;
|
||||
int iDifficulty = 0;
|
||||
int iRandom;
|
||||
int iSkillGain;
|
||||
|
||||
location lFire = GetLocation(OBJECT_SELF);
|
||||
string sSuccess = "You have successfully lautered the "+GetName(oItem)+".";
|
||||
string sFail = "The wort is contaminated with impurities and unuseable.";
|
||||
|
||||
if (sItemTag=="item_mash_001") //corn
|
||||
{
|
||||
sProduct = "item_wort_001";
|
||||
iDifficulty=100;
|
||||
}
|
||||
if (sItemTag=="item_mash_002") //wheat
|
||||
{
|
||||
sProduct = "item_wort_002";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="item_mash_003") //rice
|
||||
{
|
||||
sProduct = "item_wort_003";
|
||||
iDifficulty=-100;
|
||||
}
|
||||
if (sItemTag=="item_mash_004") //oats
|
||||
{
|
||||
sProduct = "item_wort_004";
|
||||
iDifficulty=-50;
|
||||
}
|
||||
if (sItemTag=="item_mash_005") //barley
|
||||
{
|
||||
sProduct = "item_wort_005";
|
||||
iDifficulty=200;
|
||||
}
|
||||
if (sItemTag=="item_mash_006") //sorghum
|
||||
{
|
||||
sProduct = "item_wort_006";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="item_mash_007") //acorn
|
||||
{
|
||||
sProduct = "item_wort_007";
|
||||
iDifficulty=350;
|
||||
}
|
||||
|
||||
if (sProduct=="INVALID")
|
||||
{
|
||||
SendMessageToPC(oPC,"You may not lauter this object into any form of wort!");
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
object oWater = GetItemPossessedBy(oPC,"ITEM_BUCKETOFWATER");
|
||||
if (oWater==OBJECT_INVALID)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have a full bucket of water in order to lauter this mash.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
DestroyObject(oWater,0.1);
|
||||
DelayCommand(1.0,CreateAnObject("item001",oPC,1));
|
||||
|
||||
object oSugar = GetItemPossessedBy(oPC,"item_syrup_003");
|
||||
if (oSugar==OBJECT_INVALID)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have some sugar in order to lauter this mash.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
DestroyObject(oSugar,0.2);
|
||||
|
||||
int iBrewSkill = GetPersistentInt(oPC,"iBrewSkill","UOACraft");
|
||||
int iBrewChance = iBrewSkill;
|
||||
|
||||
if (iBrewChance<350)
|
||||
{
|
||||
iBrewChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iBrewChance = iBrewChance+(GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iBrewChance = iBrewChance+(GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
|
||||
iBrewChance = iBrewChance*3;
|
||||
if (iBrewChance>350)iBrewChance=350;
|
||||
if (iBrewSkill > iBrewChance) iBrewChance=iBrewSkill;
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(12.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
DestroyObject(oItem,0.1);
|
||||
|
||||
|
||||
iBrewChance = iBrewChance-iDifficulty;
|
||||
if (iBrewChance<1)iBrewChance=1;
|
||||
|
||||
|
||||
|
||||
|
||||
//Play animations for craft process
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,6.0));
|
||||
AssignCommand(oPC,DelayCommand(6.0,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,3.0)));
|
||||
AssignCommand(oPC,DelayCommand(9.0,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,3.0)));
|
||||
DelayCommand(0.1,PlaySound("as_cv_smithwatr1"));
|
||||
DelayCommand(1.0,PlaySound("al_na_lavapool1"));
|
||||
DelayCommand(8.0,PlaySound("as_cv_pipegroan3"));
|
||||
object oTemp = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_dustplume",GetLocation(OBJECT_SELF));
|
||||
DestroyObject(oTemp,10.5);
|
||||
AssignCommand(oTemp,DelayCommand(4.0,PlaySound("as_cv_winch1")));
|
||||
AssignCommand(oTemp,DelayCommand(7.0,PlaySound("as_cv_winch1")));
|
||||
|
||||
|
||||
iRandom = Random(1000)+Random(1000)+Random(800);//Adjusted difficulty downwards by a small percent to make lowlevel cooks succeed a bit more.
|
||||
iRandom = iRandom/3;
|
||||
if (iRandom<=iBrewChance)
|
||||
{
|
||||
if (Random(1000) >= iBrewSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iBrewChance/100) iSkillGain = 1;
|
||||
}
|
||||
|
||||
iProduct = 1;
|
||||
if ((Random(1000)+500)<=iBrewChance) iProduct++;
|
||||
if (iBrewSkill==1000) iProduct = 2;
|
||||
|
||||
DelayCommand(11.0,PlaySound("as_na_splash1"));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(12.1,CreateAnObject(sProduct,oPC,iProduct)));
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(GetArea(oPC),DelayCommand(12.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
||||
DelayCommand(10.0,PlaySound("as_cv_sewermisc3"));
|
||||
return;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iBrewSkill++;
|
||||
sOldSkill2 = IntToString(iBrewSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iBrewSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iBrewSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(13.0,SetTokenPair(oPC,13,3,iBrewSkill));
|
||||
DelayCommand(12.5,SetPersistentInt(oPC,"iBrewSkill",iBrewSkill,0,"UOACraft"));
|
||||
DelayCommand(12.5,SendMessageToPC(oPC,"=================================="));
|
||||
DelayCommand(12.5,SendMessageToPC(oPC,"Your skill in brewing has gone up!"));
|
||||
DelayCommand(12.5,SendMessageToPC(oPC,"Current brewing skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(12.5,SendMessageToPC(oPC,"=================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.4,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iProduct)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,1);
|
||||
iProduct = iProduct - 1;
|
||||
if (iProduct>0) DelayCommand(0.1,CreateAnObject(sResource,oPC,iProduct));
|
||||
return;
|
||||
}
|
508
_module/nss/_craft_leathrwrk.nss
Normal file
508
_module/nss/_craft_leathrwrk.nss
Normal file
@@ -0,0 +1,508 @@
|
||||
//#include "_persist_01a"
|
||||
#include "nw_i0_plot"
|
||||
#include "aps_include"
|
||||
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag);
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration);
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode);
|
||||
|
||||
void main()
|
||||
{
|
||||
int iUseMode = 0;
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
iUseMode = 99;
|
||||
if (GetLastDisturbed() == OBJECT_SELF)
|
||||
{
|
||||
DestroyObject(GetInventoryDisturbItem());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
|
||||
|
||||
if (iUseMode == 0)
|
||||
{
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
SendMessageToPC(oPC,"You must wait till the hide currently being worked is done before starting another.");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sPeltResRef = "";
|
||||
string sPeltFailResRef = "";
|
||||
|
||||
if (GetStringLeft(sItemTag,7) != "TANNED_")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("This item is not a tanned hide!",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
int iTanMode = GetLocalInt(oPC,"iTanningMode");
|
||||
//int iTanChance = GetTokenPair(oPC,14,11);
|
||||
//int iTanSkill = iTanChance;
|
||||
int iTanSkill = GetPersistentInt(oPC,"iLeatherSkill","UOACraft");
|
||||
int iTanChance = iTanSkill;
|
||||
int iTanOil = 1;
|
||||
int iBeeswax = 1;
|
||||
int iKindling =1;
|
||||
string sPeltSuccess;
|
||||
string sPeltFail;
|
||||
|
||||
if (iTanChance <350)
|
||||
{
|
||||
iTanChance = GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*3;
|
||||
iTanChance = iTanChance + GetAbilityScore(oPC,ABILITY_WISDOM) + GetAbilityScore(oPC,ABILITY_DEXTERITY);
|
||||
iTanChance = iTanChance * 6;
|
||||
if (iTanChance >350) iTanChance = 350;
|
||||
if (iTanSkill > iTanChance) iTanChance = iTanSkill;
|
||||
}
|
||||
|
||||
string sBaseResRef = "";
|
||||
string sBaseMessage = "";
|
||||
string sBaseMessage2 = "";
|
||||
|
||||
if (iTanMode !=0)
|
||||
{
|
||||
sBaseResRef = "softleather";
|
||||
sBaseMessage = "You carefully soften the ";
|
||||
sBaseMessage2 = "You fail to soften the ";
|
||||
}
|
||||
else
|
||||
{
|
||||
sBaseResRef = "hardleather";
|
||||
sBaseMessage = "You carefully harden the ";
|
||||
sBaseMessage2 = "You fail to harden the ";
|
||||
}
|
||||
|
||||
if (sItemTag == "TANNED_TINY")
|
||||
{
|
||||
sPeltResRef = sBaseResRef+"001";
|
||||
sPeltFailResRef = "cured016";
|
||||
sPeltSuccess = sBaseMessage + "tiny tanned hide.";
|
||||
sPeltFail = sBaseMessage2+"tiny tanned hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_TINYBLACK")
|
||||
{
|
||||
iTanChance = iTanChance - 50;
|
||||
sPeltResRef = sBaseResRef+"002";
|
||||
sPeltFailResRef = "cured017";
|
||||
sPeltSuccess = sBaseMessage + "tiny tanned black hide.";
|
||||
sPeltFail = sBaseMessage2+"tiny tanned black hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_TINYWHITE")
|
||||
{
|
||||
iTanChance = iTanChance - 100;
|
||||
sPeltResRef = sBaseResRef+"003";
|
||||
sPeltFailResRef = "cured018";
|
||||
sPeltSuccess = sBaseMessage + "tiny tanned white hide.";
|
||||
sPeltFail = sBaseMessage2+"tiny tanned white hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_SMALL")
|
||||
{
|
||||
iTanChance = iTanChance - 150;
|
||||
sPeltResRef = sBaseResRef+"004";
|
||||
sPeltFailResRef = "cured019";
|
||||
sPeltSuccess = sBaseMessage + "small tanned hide.";
|
||||
sPeltFail = sBaseMessage2+"small tanned hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_SMALLBLACK")
|
||||
{
|
||||
iTanChance = iTanChance - 200;
|
||||
sPeltResRef = sBaseResRef+"005";
|
||||
sPeltFailResRef = "cured020";
|
||||
sPeltSuccess = sBaseMessage + "small tanned black hide.";
|
||||
sPeltFail = sBaseMessage2+"small tanned black hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_SMALLWHITE")
|
||||
{
|
||||
iTanChance = iTanChance - 250;
|
||||
sPeltResRef = sBaseResRef+"006";
|
||||
sPeltFailResRef = "cured021";
|
||||
sPeltSuccess = sBaseMessage + "small tanned white hide.";
|
||||
sPeltFail = sBaseMessage2+"small tanned white hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_MEDIUM")
|
||||
{
|
||||
iTanChance = iTanChance - 300;
|
||||
iTanOil = 2;
|
||||
iBeeswax = 2;
|
||||
sPeltResRef = sBaseResRef+"007";
|
||||
sPeltFailResRef = "cured022";
|
||||
sPeltSuccess = sBaseMessage + "medium tanned hide.";
|
||||
sPeltFail = sBaseMessage2+"medium tanned hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_MEDIUMBLACK")
|
||||
{
|
||||
iTanChance = iTanChance - 350;
|
||||
iTanOil = 2;
|
||||
iBeeswax = 2;
|
||||
sPeltResRef = sBaseResRef+"008";
|
||||
sPeltFailResRef = "cured023";
|
||||
sPeltSuccess = sBaseMessage + "medium tanned black hide.";
|
||||
sPeltFail = sBaseMessage2+"medium tanned black hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_MEDIUMWHITE")
|
||||
{
|
||||
iTanChance = iTanChance - 400;
|
||||
iTanOil = 2;
|
||||
iBeeswax = 2;
|
||||
sPeltResRef = sBaseResRef+"009";
|
||||
sPeltFailResRef = "cured024";
|
||||
sPeltSuccess = sBaseMessage + "medium tanned white hide.";
|
||||
sPeltFail = sBaseMessage2+"medium tanned white hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_LARGE")
|
||||
{
|
||||
iTanChance = iTanChance - 450;
|
||||
iTanOil = 3;
|
||||
iBeeswax = 3;
|
||||
iKindling = 2;
|
||||
sPeltResRef = sBaseResRef+"010";
|
||||
sPeltFailResRef = "cured025";
|
||||
sPeltSuccess = sBaseMessage + "large tanned hide.";
|
||||
sPeltFail = sBaseMessage2+"large tanned hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_LARGEBLACK")
|
||||
{
|
||||
iTanChance = iTanChance - 500;
|
||||
iTanOil = 3;
|
||||
iBeeswax = 3;
|
||||
iKindling = 2;
|
||||
sPeltResRef = sBaseResRef+"011";
|
||||
sPeltFailResRef = "cured026";
|
||||
sPeltSuccess = sBaseMessage + "large tanned black hide.";
|
||||
sPeltFail = sBaseMessage2+"large tanned black hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_LARGEWHITE")
|
||||
{
|
||||
iTanChance = iTanChance - 550;
|
||||
iTanOil = 3;
|
||||
iBeeswax = 3;
|
||||
iKindling = 2;
|
||||
sPeltResRef = sBaseResRef+"012";
|
||||
sPeltFailResRef = "cured027";
|
||||
sPeltSuccess = sBaseMessage + "large tanned white hide.";
|
||||
sPeltFail = sBaseMessage2+"large tanned white hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_XLARGE")
|
||||
{
|
||||
iTanChance = iTanChance - 600;
|
||||
iTanOil = 4;
|
||||
iBeeswax = 4;
|
||||
iKindling = 2;
|
||||
sPeltResRef = sBaseResRef+"013";
|
||||
sPeltFailResRef = "cured028";
|
||||
sPeltSuccess = sBaseMessage + "extra large tanned hide.";
|
||||
sPeltFail = sBaseMessage2+"extra large tanned hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_XLARGEBLACK")
|
||||
{
|
||||
iTanChance = iTanChance - 650;
|
||||
iTanOil = 4;
|
||||
iBeeswax = 4;
|
||||
iKindling = 2;
|
||||
sPeltResRef = sBaseResRef+"014";
|
||||
sPeltFailResRef = "cured029";
|
||||
sPeltSuccess = sBaseMessage + "extra large tanned black hide.";
|
||||
sPeltFail = sBaseMessage2+"extra large tanned black hide.";
|
||||
}
|
||||
if (sItemTag == "TANNED_XLARGEWHITE")
|
||||
{
|
||||
iTanChance = iTanChance - 700;
|
||||
iTanOil = 4;
|
||||
iBeeswax = 4;
|
||||
iKindling = 2;
|
||||
sPeltResRef = sBaseResRef+"015";
|
||||
sPeltFailResRef = "cured030";
|
||||
sPeltSuccess = sBaseMessage + "extra large tanned white hide.";
|
||||
sPeltFail = sBaseMessage2+"extra large tanned white hide.";
|
||||
}
|
||||
|
||||
if (iTanChance < 1)
|
||||
{
|
||||
FloatingTextStringOnCreature("You have no idea how to work this hide.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
iTanChance = iTanChance + 200; //<-- ensures more successes. (50% on the hardest)
|
||||
|
||||
if (iTanMode != 0)
|
||||
{
|
||||
if (GetNumItems(oPC,"ITEM_TANNINGOIL") < iTanOil)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough tanning oil to soften this tanned hide.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iTanMode == 0)
|
||||
{
|
||||
if (GetNumItems(oPC,"ITEM_BEESWAX") < iBeeswax)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough beeswax to harden this tanned hide.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (GetNumItems(oPC,"ITEM_KINDLING") < iKindling)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough kindling to work this tanned hide.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(8.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
|
||||
object oTemp = OBJECT_INVALID;
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_KINDLING");
|
||||
DestroyObject(oTemp);
|
||||
if (iKindling>1) DelayCommand(4.0,GetNextItemPossessedBy(oPC,"ITEM_KINDLING"));
|
||||
if (iKindling>2) DelayCommand(5.0,GetNextItemPossessedBy(oPC,"ITEM_KINDLING"));
|
||||
if (iKindling>3) DelayCommand(6.0,GetNextItemPossessedBy(oPC,"ITEM_KINDLING"));
|
||||
|
||||
int iStackSize = 0;
|
||||
if (iTanMode == 0)
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_BEESWAX");
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iBeeswax)
|
||||
{
|
||||
iBeeswax = iBeeswax - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,"ITEM_BEESWAX",iBeeswax,1));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iBeeswax)
|
||||
{
|
||||
iStackSize = iStackSize - iBeeswax;
|
||||
DelayCommand(1.0,CreateAnObject("beeswax",oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oTemp = GetItemPossessedBy(oPC,"ITEM_TANNINGOIL");
|
||||
iStackSize = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize < iTanOil)
|
||||
{
|
||||
iTanOil = iTanOil - iStackSize;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,"ITEM_TANNINGOIL",iTanOil,99));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize > iTanOil)
|
||||
{
|
||||
iStackSize = iStackSize - iTanOil;
|
||||
DelayCommand(1.0,CreateAnObject("tanningoil",oPC,iStackSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AssignCommand(oPC,PlaySound("as_na_splash2"));
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,6.0));
|
||||
location lSelf = GetLocation(OBJECT_SELF);
|
||||
float fSelf = GetFacing(OBJECT_SELF)+180.0;
|
||||
vector vSelf = GetPosition(OBJECT_SELF);
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
vFire = vSelf + (AngleToVector(fSelf) * 0.5);
|
||||
location lFire = Location(oArea,vFire,fSelf);
|
||||
object oFire = CreatePlaceable("plc_dustplume", lFire, 6.0);
|
||||
AssignCommand(oFire,DelayCommand(2.0,PlaySound("as_cv_smithbelo1")));
|
||||
AssignCommand(oFire,DelayCommand(3.0,PlaySound("as_cv_smithbelo1")));
|
||||
AssignCommand(oFire,DelayCommand(4.0,PlaySound("as_cv_smithbelo1")));
|
||||
AssignCommand(oFire,DelayCommand(5.0,PlaySound("as_cv_smithbelo1")));
|
||||
DelayCommand(3.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF,FALSE),GetLocation(oFire),6.0));
|
||||
AssignCommand(oFire,PlaySound("as_na_steamlong1"));
|
||||
|
||||
|
||||
|
||||
|
||||
int iRandom = Random(1000);
|
||||
int iSuccess = 0;
|
||||
int iSkillGain = 0;
|
||||
|
||||
if (iRandom < iTanChance)
|
||||
{
|
||||
iSuccess = 1;
|
||||
}
|
||||
|
||||
DelayCommand(6.0,DestroyObject(oItem));
|
||||
if (iSuccess == 1)
|
||||
{
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature(sPeltSuccess,oPC,FALSE));
|
||||
DelayCommand(6.0,CreateAnObject(sPeltResRef,oPC,1));
|
||||
iRandom = Random(1000);
|
||||
if (iRandom >= iTanSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iTanChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature(sPeltFail,oPC,FALSE));
|
||||
if (Random(1000) <= iTanSkill)
|
||||
{
|
||||
DelayCommand(7.0,FloatingTextStringOnCreature("You manage to recover the ruined hide....",oPC,FALSE));
|
||||
DelayCommand(7.0,CreateAnObject(sPeltFailResRef,oPC,1));
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iTanSkill++;
|
||||
sOldSkill2 = IntToString(iTanSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iTanSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iTanSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(6.0,SetTokenPair(oPC,14,11,iTanSkill));
|
||||
DelayCommand(6.0,SetPersistentInt(oPC,"iLeatherSkill",iTanSkill,0,"UOACraft"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"========================================="));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Your skill in leatherworking has gone up!"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"Current leatherworking skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(6.0,SendMessageToPC(oPC,"========================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(5.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // end of iUseMode = 0 (added item to inventory) section
|
||||
|
||||
if (iUseMode == 99)
|
||||
{
|
||||
if (GetTag(oItem) == "SWITCH_HARDEN")
|
||||
{
|
||||
SetLocalInt(oPC,"iTanningMode",0);
|
||||
FloatingTextStringOnCreature("Switching to 'Harden Leather' Mode...",oPC,FALSE);
|
||||
}
|
||||
if (GetTag(oItem) == "SWITCH_SOFTEN")
|
||||
{
|
||||
SetLocalInt(oPC,"iTanningMode",99);
|
||||
FloatingTextStringOnCreature("Switching to 'Soften Leather' Mode...",oPC,FALSE);
|
||||
}
|
||||
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
DestroyObject(oTemp);
|
||||
return;
|
||||
}
|
||||
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration)
|
||||
{
|
||||
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
||||
if (fDuration != 0.0)
|
||||
DestroyObject(oPlaceable,fDuration);
|
||||
return oPlaceable;
|
||||
}
|
||||
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
int iStackCount = GetNumStackedItems(oTemp);
|
||||
int iTemp = iCount - iStackCount;
|
||||
iStackCount = iStackCount-iCount;
|
||||
DestroyObject(oTemp);
|
||||
if (iStackCount > 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount)+" tannic acid");
|
||||
if (iMode == 1)
|
||||
{
|
||||
DelayCommand(1.0,CreateAnObject("beeswax",oPC,iStackCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(1.0,CreateAnObject("tanningoil",oPC,iStackCount));
|
||||
}
|
||||
}
|
||||
// this next line *should* recursively call this function if the number of
|
||||
// stacked items does not meet the required number of items to be destroyed.
|
||||
if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode));
|
||||
return;
|
||||
}
|
220
_module/nss/_craft_loom.nss
Normal file
220
_module/nss/_craft_loom.nss
Normal file
@@ -0,0 +1,220 @@
|
||||
//#include "_persist_01a"
|
||||
#include "nw_i0_plot"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
object oPC = GetLastDisturbed();
|
||||
object oSelf = OBJECT_SELF;
|
||||
string sTag = GetTag(oItem);
|
||||
string sSuccess = "";
|
||||
string sFail = "";
|
||||
string sItemResRef = "";
|
||||
int iComponent1 = 0;
|
||||
string sComponent1 = "";
|
||||
string sComponent1Name = "";
|
||||
|
||||
if (GetInventoryDisturbType()== INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
FloatingTextStringOnCreature("You can only craft by removing pattern tokens from this station.",oPC,FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
CopyObject(oItem,GetLocation(oSelf),oSelf,GetTag(oItem));
|
||||
|
||||
//int iClothSkill = GetTokenPair(oPC,13,4); // Clothmaking
|
||||
int iClothSkill = GetPersistentInt(oPC,"iClothSkill","UOACraft");
|
||||
int iClothChance = iClothSkill;
|
||||
if (iClothChance < 350)
|
||||
{
|
||||
iClothChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iClothChance = iClothChance+(GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*3);
|
||||
iClothChance = iClothChance+(GetAbilityScore(oPC,ABILITY_WISDOM)*2);
|
||||
iClothChance = iClothChance*3;
|
||||
if (iClothChance>350)iClothChance=350;
|
||||
if (iClothSkill > iClothChance) iClothChance=iClothSkill;
|
||||
}
|
||||
|
||||
effect vEffect;
|
||||
|
||||
int iDifficulty = 0;
|
||||
if (sTag == "P_CLOTH_NORMAL")
|
||||
{
|
||||
sSuccess = "You carefully weave the threads upon the loom to create a bolt of normal cloth.";
|
||||
sFail = "The threads begin to break and snap as you fail in your attempt to create the cloth.";
|
||||
sItemResRef = "boltofcloth001";
|
||||
iComponent1 = 5;
|
||||
sComponent1 = "THREAD_COTTON"; // Spindle of Normal Thread
|
||||
sComponent1Name = "spindles of thread";
|
||||
vEffect = EffectVisualEffect(VFX_DUR_PROT_STONESKIN,FALSE);
|
||||
}
|
||||
if (sTag == "P_CLOTH_WOOL")
|
||||
{
|
||||
iDifficulty = 500;
|
||||
sSuccess = "You carefully weave the yarn upon the loom to create a bolt of wool cloth.";
|
||||
sFail = "The yarn breaks in several places as you fail in your attempt to create the cloth.";
|
||||
sItemResRef = "boltofcloth002";
|
||||
iComponent1 = 5;
|
||||
sComponent1 = "THREAD_WOOL"; // ball of wool yarn
|
||||
sComponent1Name = "balls of wool yarn";
|
||||
vEffect = EffectVisualEffect(VFX_DUR_PROT_BARKSKIN,FALSE);
|
||||
}
|
||||
if (sTag == "P_CLOTH_SILK")
|
||||
{
|
||||
iDifficulty = 750;
|
||||
sSuccess = "You carefully weave the silken threads upon the loom to create a bolt of silk cloth.";
|
||||
sFail = "The threads begin to break and snap as you fail in your attempt to create the cloth.";
|
||||
sItemResRef = "boltofcloth003";
|
||||
iComponent1 = 5;
|
||||
sComponent1 = "THREAD_SILK"; // Spindle of silk thread
|
||||
sComponent1Name = "spindles of silk thread";
|
||||
vEffect = EffectVisualEffect(VFX_DUR_PROT_GREATER_STONESKIN,FALSE);
|
||||
}
|
||||
|
||||
// check for components
|
||||
if (GetNumItems(oPC,sComponent1) < iComponent1)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough "+sComponent1Name+" to do this.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(oSelf,"iAmInUse")!=0)
|
||||
{
|
||||
FloatingTextStringOnCreature("You can only weave one bolt at a time.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
SetLocalInt(oSelf,"iAmInUse",99);
|
||||
DelayCommand(13.1,SetLocalInt(oSelf,"iAmInUse",0));
|
||||
|
||||
|
||||
if (iDifficulty > iClothChance)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not know how to weave this material into cloth yet.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set Anvil to 'in use'
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(12.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,vEffect,oSelf,12.0);
|
||||
|
||||
float fPause = 1.0;
|
||||
// Remove Components
|
||||
for (iComponent1; iComponent1>0; iComponent1--)
|
||||
{
|
||||
fPause = fPause+2.0;
|
||||
AssignCommand(oPC,DelayCommand(fPause,GetNextItemPossessedBy(oPC,sComponent1)));
|
||||
AssignCommand(oPC,DelayCommand(fPause,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,1.0)));
|
||||
AssignCommand(oPC,DelayCommand(fPause+0.1,PlaySound("as_cn_smithmet2")));
|
||||
AssignCommand(oPC,DelayCommand(fPause+1.0,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,1.0)));
|
||||
AssignCommand(oPC,DelayCommand(fPause+1.1,PlaySound("as_cn_smithmet2")));
|
||||
}
|
||||
DelayCommand(0.2,PlaySound("as_cv_ropepully1"));
|
||||
DelayCommand(3.2,PlaySound("as_cv_ropepully1"));
|
||||
DelayCommand(6.2,PlaySound("as_cv_ropepully1"));
|
||||
DelayCommand(9.2,PlaySound("as_cv_ropepully1"));
|
||||
|
||||
|
||||
DestroyObject(oItem);
|
||||
iClothChance = iClothChance - (iDifficulty/2);
|
||||
int iSkillGain = 0;
|
||||
|
||||
if (Random(1000) <= iClothChance)
|
||||
{
|
||||
if (Random(1000) >= iClothSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iClothChance/100) iSkillGain = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(12.0,FloatingTextStringOnCreature(sFail,oPC,FALSE));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the item
|
||||
AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRef,oPC,1)));
|
||||
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Do skill gains
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iClothSkill++;
|
||||
sOldSkill2 = IntToString(iClothSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iClothSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iClothSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(13.0,SetTokenPair(oPC,13,4,iClothSkill));
|
||||
DelayCommand(13.0,SetPersistentInt(oPC,"iClothSkill",iClothSkill,0,"UOACraft"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"========================================="));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in clothmaking has gone up!"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"Current clothmaking skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(13.0,SendMessageToPC(oPC,"========================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
DestroyObject(oTemp);
|
||||
return;
|
||||
}
|
204
_module/nss/_craft_map.nss
Normal file
204
_module/nss/_craft_map.nss
Normal file
@@ -0,0 +1,204 @@
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag);
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void CreateAMap(string sResource, object oPC, int iStackSize, int iMapSkill);
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oArea = GetArea(oPC);
|
||||
string sAreaResRef = GetResRef(oArea);
|
||||
string sAreaName = GetName(oArea);
|
||||
|
||||
int iMapSkill = GetCampaignInt("UOACraft","iMapSkill",oPC);
|
||||
int iMapChance = iMapSkill;
|
||||
|
||||
|
||||
|
||||
string sComponent1 = "";
|
||||
string sComponent2 = "";
|
||||
string sComponent3 = "";
|
||||
string sComponent1Name = "";
|
||||
string sComponent2Name = "";
|
||||
string sComponent3Name = "";
|
||||
string sComponentResRef = "";
|
||||
int iComponent1 = 0;
|
||||
int iComponent2 = 0;
|
||||
int iComponent3 = 0;
|
||||
int iComponent1Stackable = 0;
|
||||
int iComponent2Stackable = 0;
|
||||
int iComponent3Stackable = 0;
|
||||
int iStackSize = 0;
|
||||
int iFailStackable = 0;
|
||||
string sItemResRef = "";
|
||||
string sFailResRef = "";
|
||||
|
||||
|
||||
|
||||
if (iMapChance <350)
|
||||
{
|
||||
iMapChance = GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*5;
|
||||
iMapChance = iMapChance +(GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iMapChance = iMapChance +(GetAbilityScore(oPC,ABILITY_DEXTERITY)*2);
|
||||
iMapChance = iMapChance * 3;
|
||||
if (iMapChance >350) iMapChance = 350;
|
||||
if (iMapSkill > iMapChance) iMapChance = iMapSkill;
|
||||
}
|
||||
|
||||
|
||||
object oInk = GetItemPossessedBy(oPC,"ink_mapmaker");
|
||||
if (oInk==OBJECT_INVALID)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have cartographers ink in order to draw a map!",oPC,FALSE);
|
||||
CreateItemOnObject("papr_blank_silk",oPC,1);
|
||||
return;
|
||||
}
|
||||
int iInk = GetNumStackedItems(oInk);
|
||||
if (iInk>1)
|
||||
{
|
||||
iInk--;
|
||||
SetItemStackSize(oInk,iInk);
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyObject(oInk);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Random(1000) > iMapChance)
|
||||
{
|
||||
DelayCommand(6.0,FloatingTextStringOnCreature("You fail to chart the locale properly, resulting in a useless map.",oPC,FALSE));
|
||||
DelayCommand(6.1,CreateAnObject("inscribedmap001",oPC,1));
|
||||
return;
|
||||
}
|
||||
|
||||
DelayCommand(6.5,CreateAMap("inscribedmap",oPC,1,iMapChance));
|
||||
int iSkillGain=0;
|
||||
|
||||
if (Random(1000)>=iMapSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iMapChance/100) iSkillGain = 1;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iMapSkill++;
|
||||
sOldSkill2 = IntToString(iMapSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iMapSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iMapSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(6.0,SetTokenPair(oPC,14,12,iAlchemySkill));
|
||||
DelayCommand(6.0,SetCampaignInt("UOACraft","iMapSkill",iMapSkill,oPC));
|
||||
DelayCommand(6.1,SendMessageToPC(oPC,"======================================"));
|
||||
DelayCommand(6.2,SendMessageToPC(oPC,"Your skill in cartography has gone up!"));
|
||||
DelayCommand(6.3,SendMessageToPC(oPC,"Current cartography skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(6.4,SendMessageToPC(oPC,"======================================"));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(5.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//sResRef = "inscribedmap"
|
||||
|
||||
/*
|
||||
papr_blank_silk
|
||||
ink_mapmaker
|
||||
string sMapAreaTag = GetLocalString(oMap,"sMapAreaTag");
|
||||
string sMapAreaName = GetLocalString(oMap,"sMapAreaName");
|
||||
float fMapUsedX = GetLocalFloat(oMap,"fMapPositionX");
|
||||
float fMapUsedY = GetLocalFloat(oMap,"fMapPositionY");
|
||||
float fMapUsedZ = GetLocalFloat(oMap,"fMapPositionZ");
|
||||
float fMapOrientation = GetFacing(oPC);
|
||||
object oMapArea = GetObjectByTag(sMapAreaTag);
|
||||
//May need to filter out all non-area object types in case of
|
||||
//tag-related issues.. i.e. area tag matching a sword item tag.
|
||||
|
||||
vector vMap = Vector(fMapUsedX,fMapUsedY,fMapUsedZ);
|
||||
int iMapSkill = GetLocalInt(oMap,"iMapUsedSkill");
|
||||
location lPC = Location(oMapArea,vMap,fMapOrientation);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextItemPossessedBy(object oPC, string sItemTag)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
DestroyObject(oTemp);
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
int iStackCount = GetNumStackedItems(oTemp);
|
||||
int iTemp = iCount - iStackCount;
|
||||
iStackCount = iStackCount-iCount;
|
||||
DestroyObject(oTemp);
|
||||
if (iStackCount > 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount));
|
||||
DelayCommand(1.0,CreateAnObject(sStackResRef,oPC,iStackCount));
|
||||
}
|
||||
// this next line *should* recursively call this function if the number of
|
||||
// stacked items does not meet the required number of items to be destroyed.
|
||||
if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode, sStackResRef));
|
||||
return;
|
||||
}
|
||||
|
||||
void CreateAMap(string sResource, object oPC, int iStackSize, int iMapSkill)
|
||||
{
|
||||
object oArea = GetArea(oPC);
|
||||
string sAreaTag = GetTag(oArea);
|
||||
string sAreaName = GetName(oArea);
|
||||
vector vPC = GetPosition(oPC);
|
||||
float fMapX = vPC.x;
|
||||
float fMapY = vPC.y;
|
||||
float fMapZ = vPC.z;
|
||||
object oMap = CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
SetLocalString(oMap,"sMapAreaTag",sAreaTag);
|
||||
SetLocalString(oMap,"sMapAreaName",sAreaName);
|
||||
SetLocalFloat(oMap,"fMapPositionX",fMapX);
|
||||
SetLocalFloat(oMap,"fMapPositionY",fMapY);
|
||||
SetLocalFloat(oMap,"fMapPositionZ",fMapZ);
|
||||
SetLocalInt(oMap,"iMapUsedSkill",iMapSkill);
|
||||
|
||||
return;
|
||||
}
|
||||
|
220
_module/nss/_craft_mash.nss
Normal file
220
_module/nss/_craft_mash.nss
Normal file
@@ -0,0 +1,220 @@
|
||||
#include "aps_include"
|
||||
void CreateAnObject(string sResource, object oPC, int iProduct);
|
||||
|
||||
void main()
|
||||
{
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
if (GetLastDisturbed() == OBJECT_SELF)
|
||||
{
|
||||
DestroyObject(GetInventoryDisturbItem());
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this mill may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
SendMessageToPC(oPC,"You must wait until the mash is done before starting another batch.");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sProduct = "INVALID";
|
||||
int iProduct = 1;
|
||||
int iDifficulty = 0;
|
||||
int iRandom;
|
||||
int iSkillGain;
|
||||
|
||||
location lFire = GetLocation(OBJECT_SELF);
|
||||
string sSuccess = "You have successfully mashed the "+GetName(oItem)+".";
|
||||
string sFail = "The mash is contaminated with impurities and unuseable.";
|
||||
|
||||
if (sItemTag=="ITEM_MEAL_001") //corn
|
||||
{
|
||||
sProduct = "item_mash_001";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_002") //wheat
|
||||
{
|
||||
sProduct = "item_mash_002";
|
||||
iDifficulty=0;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_003") //rice
|
||||
{
|
||||
sProduct = "item_mash_003";
|
||||
iDifficulty=-150;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_004") //oats
|
||||
{
|
||||
sProduct = "item_mash_004";
|
||||
iDifficulty=-50;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_005") //barley
|
||||
{
|
||||
sProduct = "item_mash_005";
|
||||
iDifficulty=50;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_006") //sorghum
|
||||
{
|
||||
sProduct = "item_mash_006";
|
||||
iDifficulty=-100;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_007") //acorn
|
||||
{
|
||||
sProduct = "item_mash_007";
|
||||
iDifficulty=150;
|
||||
}
|
||||
|
||||
if (sProduct=="INVALID")
|
||||
{
|
||||
SendMessageToPC(oPC,"You may only mash grain meal!");
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
object oWater = GetItemPossessedBy(oPC,"ITEM_BUCKETOFWATER");
|
||||
if (oWater==OBJECT_INVALID)
|
||||
{
|
||||
FloatingTextStringOnCreature("You must have a full bucket of water in order to mash this meal.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int iBrewSkill = GetPersistentInt(oPC,"iBrewSkill","UOACraft");
|
||||
int iBrewChance = iBrewSkill;
|
||||
|
||||
if (iBrewChance<350)
|
||||
{
|
||||
iBrewChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iBrewChance = iBrewChance+(GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iBrewChance = iBrewChance+(GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
|
||||
iBrewChance = iBrewChance*3;
|
||||
if (iBrewChance>350)iBrewChance=350;
|
||||
if (iBrewSkill > iBrewChance) iBrewChance=iBrewSkill;
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(12.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
DestroyObject(oItem,0.1);
|
||||
DestroyObject(oWater,0.1);
|
||||
DelayCommand(1.0,CreateAnObject("item001",oPC,1));
|
||||
|
||||
iBrewChance = iBrewChance-iDifficulty;
|
||||
if (iBrewChance<1)iBrewChance=1;
|
||||
|
||||
|
||||
|
||||
|
||||
//Play animations for craft process
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,6.0));
|
||||
AssignCommand(oPC,DelayCommand(6.0,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,3.0)));
|
||||
AssignCommand(oPC,DelayCommand(9.0,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,3.0)));
|
||||
DelayCommand(0.1,PlaySound("as_na_grassmove1"));
|
||||
DelayCommand(3.0,PlaySound("as_na_grassmove2"));
|
||||
DelayCommand(5.0,PlaySound("as_na_grassmove1"));
|
||||
DelayCommand(8.0,PlaySound("as_na_grassmove2"));
|
||||
|
||||
|
||||
|
||||
|
||||
iRandom = Random(1000)+Random(1000)+Random(800);//Adjusted difficulty downwards by a small percent to make lowlevel cooks succeed a bit more.
|
||||
iRandom = iRandom/3;
|
||||
if (iRandom<=iBrewChance)
|
||||
{
|
||||
if (Random(1000) >= iBrewSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iBrewChance/100) iSkillGain = 1;
|
||||
}
|
||||
|
||||
iProduct = 1;
|
||||
if (Random(1050)<=iBrewChance) iProduct++;
|
||||
if (Random(1100)<=iBrewChance) iProduct++;
|
||||
if (Random(1150)<=iBrewChance) iProduct++;
|
||||
if (Random(1200)<=iBrewChance) iProduct++;
|
||||
if (iBrewSkill==1000) iProduct = 6;
|
||||
|
||||
DelayCommand(10.0,PlaySound("as_cv_smithwatr2"));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(12.1,CreateAnObject(sProduct,oPC,iProduct)));
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignCommand(GetArea(oPC),DelayCommand(12.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
||||
DelayCommand(10.0,PlaySound("as_cv_sewermisc1"));
|
||||
return;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iBrewSkill++;
|
||||
sOldSkill2 = IntToString(iBrewSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iBrewSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iBrewSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(13.0,SetTokenPair(oPC,13,3,iBrewSkill));
|
||||
DelayCommand(12.5,SetPersistentInt(oPC,"iBrewSkill",iBrewSkill,0,"UOACraft"));
|
||||
DelayCommand(12.5,SendMessageToPC(oPC,"=================================="));
|
||||
DelayCommand(12.5,SendMessageToPC(oPC,"Your skill in brewing has gone up!"));
|
||||
DelayCommand(12.5,SendMessageToPC(oPC,"Current brewing skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(12.5,SendMessageToPC(oPC,"=================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.4,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iProduct)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,1);
|
||||
iProduct = iProduct - 1;
|
||||
if (iProduct>0) DelayCommand(0.1,CreateAnObject(sResource,oPC,iProduct));
|
||||
return;
|
||||
}
|
235
_module/nss/_craft_mill.nss
Normal file
235
_module/nss/_craft_mill.nss
Normal file
@@ -0,0 +1,235 @@
|
||||
#include "aps_include"
|
||||
void CreateAnObject(string sResource, object oPC);
|
||||
|
||||
void main()
|
||||
{
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
if (GetLastDisturbed() == OBJECT_SELF)
|
||||
{
|
||||
DestroyObject(GetInventoryDisturbItem());
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this mill may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
SendMessageToPC(oPC,"You must wait until the grain in the mill is done before starting another batch.");
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sProduct = "INVALID";
|
||||
int iDifficulty = 0;
|
||||
int iRandom;
|
||||
int iSkillGain;
|
||||
string sSuccess = "You have successfully ground the "+GetName(oItem)+" into meal.";
|
||||
string sFail = "The meal is ruined by improper milling.";
|
||||
|
||||
if (sItemTag=="SEED_CORN")
|
||||
{
|
||||
sProduct = "item_meal_001";
|
||||
iDifficulty = 50;
|
||||
}
|
||||
if (sItemTag=="SEED_WHEAT")
|
||||
{
|
||||
sProduct = "item_meal_002";
|
||||
iDifficulty = 0;
|
||||
}
|
||||
if (sItemTag=="SEED_RICE")
|
||||
{
|
||||
sProduct = "item_meal_003";
|
||||
iDifficulty = -100;
|
||||
}
|
||||
if (sItemTag=="SEED_OATS")
|
||||
{
|
||||
sProduct = "item_meal_004";
|
||||
iDifficulty = -50;
|
||||
}
|
||||
if (sItemTag=="SEED_BARLEY")
|
||||
{
|
||||
sProduct = "item_meal_005";
|
||||
iDifficulty = 150;
|
||||
}
|
||||
if (sItemTag=="SEED_SORGHUM")
|
||||
{
|
||||
sProduct = "item_meal_006";
|
||||
iDifficulty = 0;
|
||||
}
|
||||
if (sItemTag=="ITEM_ACORN")
|
||||
{
|
||||
sProduct = "item_meal_007";
|
||||
iDifficulty = 100;
|
||||
}
|
||||
|
||||
if (sProduct=="INVALID")
|
||||
{
|
||||
sSuccess = "You have successfully ground the "+GetName(oItem)+" into flour.";
|
||||
sFail = "The flour is ruined by improper milling.";
|
||||
}
|
||||
|
||||
if (sItemTag=="ITEM_MEAL_001")
|
||||
{
|
||||
sProduct = "item_flour_001";
|
||||
iDifficulty = 150;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_002")
|
||||
{
|
||||
sProduct = "item_flour_002";
|
||||
iDifficulty = 100;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_003")
|
||||
{
|
||||
sProduct = "item_flour_003";
|
||||
iDifficulty = 0;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_004")
|
||||
{
|
||||
sProduct = "item_flour_004";
|
||||
iDifficulty = 50;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_005")
|
||||
{
|
||||
sProduct = "item_flour_005";
|
||||
iDifficulty = 300;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_006")
|
||||
{
|
||||
sProduct = "item_flour_006";
|
||||
iDifficulty = 100;
|
||||
}
|
||||
if (sItemTag=="ITEM_MEAL_007")
|
||||
{
|
||||
sProduct = "item_flour_007";
|
||||
iDifficulty = 200;
|
||||
}
|
||||
|
||||
if (sProduct=="INVALID")
|
||||
{
|
||||
SendMessageToPC(oPC,"You may not mill this object into any form of meal or flour!");
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
int iCookSkill = GetPersistentInt(oPC,"iCookSkill","UOACraft");
|
||||
int iCookChance = iCookSkill;
|
||||
DestroyObject(oItem,0.1);
|
||||
|
||||
if (iCookChance<350)
|
||||
{
|
||||
iCookChance = GetAbilityScore(oPC,ABILITY_WISDOM)*5;
|
||||
iCookChance = iCookChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
|
||||
iCookChance = iCookChance+(GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
|
||||
iCookChance = iCookChance*3;
|
||||
if (iCookChance>350)iCookChance=350;
|
||||
if (iCookSkill > iCookChance) iCookChance=iCookSkill;
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(10.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
iCookChance = iCookChance-iDifficulty;
|
||||
object oTemp = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_dustplume",GetLocation(OBJECT_SELF));
|
||||
DestroyObject(oTemp,9.0);
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,10.0));
|
||||
PlaySound("al_cv_millwheel1");
|
||||
AssignCommand(oTemp,DelayCommand(0.1,PlaySound("al_cv_fanlg1")));
|
||||
AssignCommand(oPC,DelayCommand(5.0,PlaySound("as_na_x2iccrmb6")));
|
||||
AssignCommand(oPC,DelayCommand(6.0,PlaySound("as_na_x2iccrmb7")));
|
||||
AssignCommand(oPC,DelayCommand(7.0,PlaySound("as_na_x2iccrmb9")));
|
||||
AssignCommand(oPC,DelayCommand(8.0,PlaySound("as_na_x2iccrmb7")));
|
||||
AssignCommand(oPC,DelayCommand(9.0,PlaySound("as_na_x2iccrmb9")));
|
||||
|
||||
|
||||
if (iCookChance<1)iCookChance=1;
|
||||
|
||||
iRandom = Random(1000)+Random(1000)+Random(800);//Adjusted difficulty downwards by a small percent to make lowlevel cooks succeed a bit more.
|
||||
iRandom = iRandom/3;
|
||||
if (iRandom<=iCookChance)
|
||||
{
|
||||
if (Random(1000) >= iCookSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iCookChance/100) iSkillGain = 1;
|
||||
}
|
||||
DelayCommand(9.0,PlaySound("as_na_steamshrt2"));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(10.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(10.1,CreateAnObject(sProduct,oPC)));
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(9.0,PlaySound("as_cv_woodbreak3"));
|
||||
AssignCommand(GetArea(oPC),DelayCommand(10.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
||||
return;
|
||||
}
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iCookSkill++;
|
||||
sOldSkill2 = IntToString(iCookSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iCookSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iCookSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(13.0,SetTokenPair(oPC,13,3,iCookSkill));
|
||||
DelayCommand(14.5,SetPersistentInt(oPC,"iCookSkill",iCookSkill,0,"UOACraft"));
|
||||
DelayCommand(14.5,SendMessageToPC(oPC,"=================================="));
|
||||
DelayCommand(14.5,SendMessageToPC(oPC,"Your skill in cooking has gone up!"));
|
||||
DelayCommand(14.5,SendMessageToPC(oPC,"Current cooking skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(14.5,SendMessageToPC(oPC,"=================================="));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(14.4,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,1);
|
||||
return;
|
||||
}
|
258
_module/nss/_craft_papermill.nss
Normal file
258
_module/nss/_craft_papermill.nss
Normal file
@@ -0,0 +1,258 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
object oSelf = OBJECT_SELF;
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sItemResRef = GetResRef(oItem);
|
||||
string sSuccess = "";
|
||||
string sProduct = "papr_blank_";
|
||||
int iProduct = 0;
|
||||
int iDifficulty = 0;
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetStringLeft(sItemTag,5)!="pulp_")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("This is not bleached pulp.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemTag,3)!="001") //pulp_wood_raw001, pulp_rice_raw001, pulp_silk_raw001
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("You must first bleach this pulp before pressing and making it into paper.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("The paper mill is not yet done with it's current task.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
object oItem2 = GetItemPossessedBy(oSelf,GetTag(oItem));
|
||||
int iStackSize = GetNumStackedItems(oItem2);
|
||||
//FloatingTextStringOnCreature("STACK = "+IntToString(iStackSize),oPC,FALSE);
|
||||
|
||||
if (sItemTag=="pulp_wood_raw001")
|
||||
{
|
||||
//Normal Paper
|
||||
iDifficulty = 250;
|
||||
sProduct=sProduct+"norma";
|
||||
sSuccess = "You carefully screen and press the wood pulp into normal paper.";
|
||||
}
|
||||
|
||||
if (sItemTag=="pulp_rice_raw001")
|
||||
{
|
||||
//Rice Paper
|
||||
sProduct=sProduct+"rice";
|
||||
sSuccess = "You carefully screen and press the rice pulp into rice paper.";
|
||||
}
|
||||
|
||||
if (sItemTag=="pulp_silk_raw001")
|
||||
{
|
||||
//Silk Paper
|
||||
iDifficulty = 500;
|
||||
sProduct=sProduct+"silk";
|
||||
sSuccess = "You carefully screen and press the silk and wood pulp into silk paper.";
|
||||
}
|
||||
|
||||
//int iPaperSkill = GetTokenPair(oPC,13,13);
|
||||
int iPaperSkill = GetPersistentInt(oPC,"iPaperSkill","UOACraft");
|
||||
int iPaperChance = iPaperSkill;
|
||||
if (iPaperSkill <350)
|
||||
{
|
||||
iPaperChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iPaperChance = iPaperChance + (GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iPaperChance = iPaperChance + (GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
|
||||
iPaperChance = iPaperChance *3;
|
||||
if (iPaperChance>350)iPaperChance = 350;
|
||||
if (iPaperSkill>iPaperChance) iPaperChance = iPaperSkill;
|
||||
}
|
||||
|
||||
if (iDifficulty>iPaperSkill)
|
||||
{
|
||||
FloatingTextStringOnCreature("You have no idea how to process this pulp into paper.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(31.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
location lSelf = GetLocation(OBJECT_SELF);
|
||||
vector vSelf = GetPosition(OBJECT_SELF);
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
float fSelf;
|
||||
int iRandom;
|
||||
float fDistance;
|
||||
location lFire;
|
||||
fSelf = GetFacing(OBJECT_SELF)+270.0;
|
||||
|
||||
int iLoop = 30;
|
||||
float fDelay3 = 0.0;
|
||||
int iPosition = 15;
|
||||
|
||||
for (iLoop; iLoop>0; iLoop--)
|
||||
{
|
||||
if (iLoop>14)
|
||||
{
|
||||
iPosition = iPosition - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
iPosition = iPosition+1;
|
||||
}
|
||||
if (iLoop==14) fSelf = GetFacing(OBJECT_SELF)+90;
|
||||
fDelay3 = fDelay3+1.0;
|
||||
fDistance = (IntToFloat(iPosition)/17.0);
|
||||
vFire = vSelf + (AngleToVector(fSelf) * fDistance);
|
||||
vFire.z += 0.5;
|
||||
lFire = Location(oArea,vFire,fSelf);
|
||||
DelayCommand(fDelay3,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF),lFire));
|
||||
}
|
||||
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,30.0));
|
||||
|
||||
PlaySound("al_cv_millwheel1");
|
||||
DelayCommand(5.9,PlaySound("al_cv_millwheel1"));
|
||||
DelayCommand(11.9,PlaySound("al_cv_millwheel1"));
|
||||
DelayCommand(17.9,PlaySound("al_cv_millwheel1"));
|
||||
DelayCommand(23.9,PlaySound("al_cv_millwheel1"));
|
||||
|
||||
PlaySound("al_cv_firetorch1");
|
||||
DelayCommand(5.9,PlaySound("al_cv_firetorch1"));
|
||||
DelayCommand(11.9,PlaySound("al_cv_firetorch1"));
|
||||
DelayCommand(17.9,PlaySound("al_cv_firetorch1"));
|
||||
DelayCommand(23.9,PlaySound("al_cv_firetorch1"));
|
||||
|
||||
PlaySound("al_cv_fanlg1");
|
||||
DelayCommand(4.9,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(9.9,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(14.9,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(19.9,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(24.9,PlaySound("al_cv_fanlg1"));
|
||||
|
||||
PlaySound("al_cv_pump");
|
||||
DelayCommand(5.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(8.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(11.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(14.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(17.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(20.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(23.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(26.9,PlaySound("al_cv_pump"));
|
||||
|
||||
DelayCommand(2.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(6.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(10.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(14.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(18.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(22.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(26.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(30.0,PlaySound("as_cv_smithbelo1"));
|
||||
|
||||
|
||||
|
||||
|
||||
int iSkillGain=0;
|
||||
iPaperChance = iPaperChance-iDifficulty;
|
||||
if (Random(1000)<iPaperChance)
|
||||
{
|
||||
if (Random(1000) >= iPaperSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iPaperChance/100) iSkillGain = 1;
|
||||
}
|
||||
DelayCommand(30.0,CreateAnObject(sProduct,oPC,iStackSize));
|
||||
DelayCommand(30.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iPaperSkill++;
|
||||
sOldSkill2 = IntToString(iPaperSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iPaperSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iPaperSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(30.0,SetTokenPair(oPC,13,13,iPaperSkill));
|
||||
DelayCommand(30.0,SetPersistentInt(oPC,"iPaperSkill",iPaperSkill,0,"UOACraft"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"======================================"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"Your skill in papermaking has gone up!"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"Current papermaking skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"======================================"));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(29.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(30.0,FloatingTextStringOnCreature("The paper fails to set properly to the screen and is lost.",oPC,FALSE));
|
||||
if (iStackSize>1) iStackSize = Random(iStackSize)-1;
|
||||
if (iStackSize>0)
|
||||
{
|
||||
DelayCommand(31.0,FloatingTextStringOnCreature("You manage to recover some of the pulp.",oPC,FALSE));
|
||||
DelayCommand(31.0,CreateAnObject(sItemTag,oPC,iStackSize));
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
304
_module/nss/_craft_pulp.nss
Normal file
304
_module/nss/_craft_pulp.nss
Normal file
@@ -0,0 +1,304 @@
|
||||
//#include "_persist_01a"
|
||||
#include "nw_i0_plot"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef);
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration);
|
||||
void DelaySilk(object oPC);
|
||||
|
||||
void main()
|
||||
{
|
||||
int iUseMode = 0;
|
||||
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)iUseMode = 99;
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sSuccess = "";
|
||||
object oSelf = OBJECT_SELF;
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
if (iUseMode!=99) CopyItem(oItem,oPC,TRUE);
|
||||
if (iUseMode==99) CopyObject(oItem,GetLocation(oSelf),oSelf,GetTag(oItem));
|
||||
FloatingTextStringOnCreature("The pulp basin is not yet ready for more materials.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (iUseMode==99)
|
||||
{
|
||||
if (sItemTag=="P_PULP_BLEACHED")
|
||||
{
|
||||
SetLocalInt(oPC,"iPulpType",0);
|
||||
FloatingTextStringOnCreature("Setting up to bleach normal wood or rice pulp.",oPC,FALSE);
|
||||
}
|
||||
if (sItemTag=="P_PULP_BLEACHED_SILK")
|
||||
{
|
||||
SetLocalInt(oPC,"iPulpType",1);
|
||||
FloatingTextStringOnCreature("Setting up to bleach wood pulp with silk additive.",oPC,FALSE);
|
||||
}
|
||||
string sTagSelf = GetTag(oSelf);
|
||||
AssignCommand(oPC,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE));
|
||||
AssignCommand(oPC,DelayCommand(1.5,DoPlaceableObjectAction(GetNearestObjectByTag(sTagSelf,oPC,1),PLACEABLE_ACTION_USE)));
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
int iPulpType = GetLocalInt(oPC,"iPulpType");
|
||||
|
||||
|
||||
if (sItemTag!="pulp_wood_raw")
|
||||
{
|
||||
if (sItemTag!="pulp_rice_raw")
|
||||
{
|
||||
if (GetStringLeft(sItemTag,13)!= "item_parchmen")
|
||||
{
|
||||
FloatingTextStringOnCreature("This is not raw pulp or digested parchment!",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//int iSubtract = 0;
|
||||
//if (GetResRef(oItem)=="")
|
||||
// {
|
||||
// object oTemp2 = CreateItemOnObject(sItemTag,OBJECT_SELF,1);
|
||||
// if (oTemp2==OBJECT_INVALID)
|
||||
// {
|
||||
// CopyObject(oItem,GetLocation(oPC),oPC,sItemTag);
|
||||
// DestroyObject(oItem);
|
||||
// FloatingTextStringOnCreature("This item has been returned due to missing ResRef! (It is either a split stack or an imported object)",oPC,FALSE);
|
||||
// return;
|
||||
// }
|
||||
// oItem=GetItemPossessedBy(oSelf,sItemTag);
|
||||
// iSubtract=1;
|
||||
//DestroyObject(oTemp2);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//int iPaperSkill = GetTokenPair(oPC,13,7);
|
||||
int iPaperSkill = GetPersistentInt(oPC,"iPaperSkill","UOACraft");
|
||||
int iPaperChance = iPaperSkill;
|
||||
if (iPaperSkill <350)
|
||||
{
|
||||
iPaperChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iPaperChance = iPaperChance + (GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iPaperChance = iPaperChance + (GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
|
||||
iPaperChance = iPaperChance *3;
|
||||
if (iPaperChance>350)iPaperChance = 350;
|
||||
if (iPaperSkill>iPaperChance) iPaperChance = iPaperSkill;
|
||||
}
|
||||
|
||||
//int iStackSize = GetNumStackedItems(oItem);
|
||||
int iStackSize = GetNumItems(oSelf,GetTag(oItem)); //-iSubtract;
|
||||
|
||||
//if (iStackSize==0)
|
||||
// {
|
||||
// FloatingTextStringOnCreature("Invalid StackSize..",oPC,FALSE);
|
||||
// CopyObject(oItem,GetLocation(oPC),oPC,sItemTag);
|
||||
// DestroyObject(oItem);
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
int iStackSize2 = GetNumItems(oPC,"item_chlorine");
|
||||
|
||||
if (iStackSize2<iStackSize)
|
||||
{
|
||||
if (sItemTag=="pulp_wood_raw")FloatingTextStringOnCreature("You do not have enough bleaching agent to process this much wood pulp.",oPC,FALSE);
|
||||
if (sItemTag=="pulp_rice_raw")FloatingTextStringOnCreature("You do not have enough bleaching agent to process this much rice pulp.",oPC,FALSE);
|
||||
if (GetStringLeft(sItemTag,13)=="item_parchmen")FloatingTextStringOnCreature("You do not have enough bleaching agent to process this digested parchment.",oPC,FALSE);
|
||||
CopyObject(oItem,GetLocation(oPC),oPC,sItemTag);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (iPulpType==1)
|
||||
{
|
||||
if (GetNumItems(oPC,"ITEM_SPIDERSILK")<iStackSize)
|
||||
{
|
||||
FloatingTextStringOnCreature("You do not have enough spider's silk to process this much pulp.",oPC,FALSE);
|
||||
CopyObject(oItem,GetLocation(oPC),oPC,sItemTag);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
string sResRef="";
|
||||
int iStack = 0;
|
||||
|
||||
if (sItemTag=="pulp_wood_raw")
|
||||
{
|
||||
sResRef = "pulp_wood_raw001";
|
||||
iStack = iStackSize;
|
||||
sSuccess = "You carefully process the wood pulp with the pulp bleach.";
|
||||
if (iPulpType==1)
|
||||
{
|
||||
sResRef = "pulp_silk_raw001";
|
||||
sSuccess = "You carefully stir in the silk strands, and process the silk and wood pulp with the pulp bleach.";
|
||||
}
|
||||
}
|
||||
if (sItemTag=="pulp_rice_raw")
|
||||
{
|
||||
sResRef = "pulp_rice_raw001";
|
||||
iStack = iStackSize;
|
||||
sSuccess = "You carefully process the rice pulp with the pulp bleach.";
|
||||
}
|
||||
if (GetStringLeft(sItemTag,13)=="item_parchmen")
|
||||
{
|
||||
int iValue = StringToInt(GetStringRight(sItemTag,3));
|
||||
string sType = "norma";
|
||||
iStack = 1;
|
||||
if (iValue>3) iStack = 2;
|
||||
if (iValue>6) iStack = 4;
|
||||
if (iValue>9) iStack = 7;
|
||||
if (iValue>12) iStack = 10;
|
||||
switch (iValue)
|
||||
{
|
||||
case 2:{sType="black";break;}
|
||||
case 3:{sType="white";break;}
|
||||
case 5:{sType="black";break;}
|
||||
case 6:{sType="white";break;}
|
||||
case 8:{sType="black";break;}
|
||||
case 9:{sType="white";break;}
|
||||
case 11:{sType="black";break;}
|
||||
case 12:{sType="white";break;}
|
||||
case 14:{sType="black";break;}
|
||||
case 15:{sType="white";break;}
|
||||
default:{sType="norma";break;}
|
||||
}
|
||||
sResRef = "scrl_blank_"+sType;
|
||||
if (sType=="norma") sType = "normal";
|
||||
sSuccess = "You carefully bleach, dry, and cut the digested "+sType+" parchment.";
|
||||
iStackSize = iStack;
|
||||
}
|
||||
|
||||
//Remove Components (bleaching agent)
|
||||
object oTemp = GetItemPossessedBy(oPC,"item_chlorine");
|
||||
string sComponentResRef = GetResRef(oTemp);
|
||||
iStackSize2 = GetNumStackedItems(oTemp);
|
||||
DestroyObject(oTemp);
|
||||
if (iStackSize2 < iStack)
|
||||
{
|
||||
iStack = iStack - iStackSize2;
|
||||
DelayCommand(2.0,GetNextStackedItem(oPC,"item_chlorine",iStack,1,"item_chlorine"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iStackSize2 > iStack)
|
||||
{
|
||||
iStackSize2 = iStackSize2 - iStack;
|
||||
DelayCommand(1.0,CreateAnObject("item_chlorine",oPC,iStackSize2));
|
||||
}
|
||||
}
|
||||
|
||||
//remove the spider silk
|
||||
if (iPulpType==1)
|
||||
{
|
||||
int iSilk = GetNumStackedItems(oItem);
|
||||
float fDelay2 = 0.0;
|
||||
for (iSilk; iSilk>0; iSilk--)
|
||||
{
|
||||
fDelay2=fDelay2+0.5;
|
||||
DelayCommand(fDelay2,DelaySilk(oPC));
|
||||
}
|
||||
}
|
||||
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,19.0));
|
||||
PlaySound("as_na_splash2");
|
||||
DelayCommand(0.5,PlaySound("al_na_waterpool1"));
|
||||
DelayCommand(10.0,PlaySound("al_na_waterpool1"));
|
||||
DelayCommand(1.0,PlaySound("as_na_waterlap3"));
|
||||
DelayCommand(7.0,PlaySound("as_na_waterlap3"));
|
||||
DelayCommand(13.0,PlaySound("as_na_waterlap3"));
|
||||
if (GetStringLeft(sResRef,4)=="scrl")
|
||||
{
|
||||
AssignCommand(oPC,DelayCommand(19.0,PlaySound("as_cv_shopmetal2")));
|
||||
AssignCommand(oPC,DelayCommand(20.0,PlaySound("as_cv_shopmetal2")));
|
||||
AssignCommand(oPC,DelayCommand(21.0,PlaySound("as_cv_shopmetal2")));
|
||||
}
|
||||
|
||||
DelayCommand(20.0,CreateAnObject(sResRef,oPC,iStackSize));
|
||||
DelayCommand(20.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
||||
|
||||
|
||||
// This snippet of code is cut-n-paste direct from ATS
|
||||
// Reason for this is because I had no clue how to assign an increase
|
||||
// in the z-axis of the location of the anvil for sparks to display.
|
||||
// After reading through this code, it is obvious that vEffecrPos.z
|
||||
// is the line which assigns this. Due to my own ignorance in this issue
|
||||
// I have decided to leave this snippet of code intact with this credit to
|
||||
// the original ATS script coders, whomever they may have been.
|
||||
|
||||
location locAnvil = GetLocation(OBJECT_SELF);
|
||||
vector vEffectPos = GetPositionFromLocation(locAnvil);
|
||||
vEffectPos.z += 0.3;
|
||||
location locEffect = Location( GetAreaFromLocation(locAnvil), vEffectPos,GetFacingFromLocation(locAnvil) );
|
||||
CreatePlaceable("plc_dustplume",locEffect,18.5);
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(20.1,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
DestroyObject(oItem);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
||||
|
||||
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef)
|
||||
{
|
||||
object oTemp = GetItemPossessedBy(oPC,sItemTag);
|
||||
int iStackCount = GetNumStackedItems(oTemp);
|
||||
int iTemp = iCount - iStackCount;
|
||||
iStackCount = iStackCount-iCount;
|
||||
DestroyObject(oTemp);
|
||||
if (iStackCount > 0)
|
||||
{
|
||||
SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount));
|
||||
DelayCommand(1.0,CreateAnObject(sStackResRef,oPC,iStackCount));
|
||||
}
|
||||
// this next line *should* recursively call this function if the number of
|
||||
// stacked items does not meet the required number of items to be destroyed.
|
||||
if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode, sStackResRef));
|
||||
return;
|
||||
}
|
||||
|
||||
object CreatePlaceable(string sObject, location lPlace, float fDuration)
|
||||
{
|
||||
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
||||
if (fDuration != 0.0)
|
||||
DestroyObject(oPlaceable,fDuration);
|
||||
return oPlaceable;
|
||||
}
|
||||
|
||||
void DelaySilk(object oPC)
|
||||
{
|
||||
object oTemp3 = GetItemPossessedBy(oPC,"ITEM_SILK");
|
||||
DestroyObject(oTemp3);
|
||||
return;
|
||||
}
|
1948
_module/nss/_craft_scribe.nss
Normal file
1948
_module/nss/_craft_scribe.nss
Normal file
File diff suppressed because it is too large
Load Diff
49
_module/nss/_craft_spider.nss
Normal file
49
_module/nss/_craft_spider.nss
Normal file
@@ -0,0 +1,49 @@
|
||||
void main()
|
||||
{
|
||||
int iSilkNum = GetLocalInt(OBJECT_SELF,"iSilk");
|
||||
if (iSilkNum<1) return;
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
|
||||
|
||||
if (GetInventoryDisturbType()== INVENTORY_DISTURB_TYPE_ADDED)
|
||||
{
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem,1.0);
|
||||
}
|
||||
|
||||
float fSelf = GetFacing(oPC)+Random(360);
|
||||
object oArea = GetArea(oPC);
|
||||
vector vSelf = GetPosition(oPC);
|
||||
object oTemp = OBJECT_INVALID;
|
||||
float fDistance = (IntToFloat(Random(100)+1)/10.0);
|
||||
vector vFire = vSelf + (AngleToVector(fSelf) * fDistance);
|
||||
location lFire = Location(oArea,vFire,fSelf);
|
||||
if (Random(1000)<350)
|
||||
{
|
||||
string sSpiderResRef = "spidgiant001";
|
||||
if (Random(1000)<500) sSpiderResRef="spidgiant002";
|
||||
if (Random(1000)<350) sSpiderResRef="spidgiant002";
|
||||
oTemp = CreateObject(OBJECT_TYPE_CREATURE,sSpiderResRef,lFire,TRUE);
|
||||
AssignCommand(oTemp,SetFacingPoint(AngleToVector(GetFacing(oPC))));
|
||||
AssignCommand(oTemp, ActionAttack(oPC,FALSE));
|
||||
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_DUR_WEB,FALSE),lFire,600.0);
|
||||
FloatingTextStringOnCreature("You have disturbed a dormant spider!",oPC,FALSE);
|
||||
iSilkNum--;
|
||||
SetLocalInt(OBJECT_SELF,"iSilk",iSilkNum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user