/**************************************************************************** * [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame | * * -----------------------------------------------------------| \\._.// * * SmaugWiz (C) 1998 by Russ Pillsbury (Windows NT version) | (0...0) * * -----------------------------------------------------------| ).:.( * * SMAUG (C) 1994, 1995, 1996 by Derek Snider | {o o} * * -----------------------------------------------------------| / ' ' \ * * SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus, |~'~.VxvxV.~'~* * Scryn, Swordbearer, Rennard, Tricops, and Gorog. | * * ------------------------------------------------------------------------ * * Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael * * Chastain, Michael Quan, and Mitchell Tse. * * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik Staerfeldt, Tom Madsen, and Katja Nyboe. * * ------------------------------------------------------------------------ * * Specific object creation module * ****************************************************************************/ #include "stdafx.h" #include "smaug.h" #include "mobiles.h" #include "affect.h" #include "objects.h" #include "rooms.h" #include "area.h" #include "descriptor.h" #include "character.h" // Make a fire. void make_fire (CRoomIndexData *in_room, short timer) { CObjData *fire; fire = create_object (OIdxTable.GetObj (OBJ_VNUM_FIRE), 0); fire->timer = number_fuzzy (timer); obj_to_room (fire, in_room); } // Make a trap. CObjData *make_trap (int v0, int v1, int v2, int v3) { CObjData *trap; trap = create_object (OIdxTable.GetObj (OBJ_VNUM_TRAP), 0); trap->timer = 0; trap->value [0] = v0; trap->value [1] = v1; trap->value [2] = v2; trap->value [3] = v3; return trap; } // Turn an object into scraps. -Thoric void make_scraps (CObjData *obj) { char buf [MAX_STRING_LENGTH]; CObjData *scraps, *tmpobj; CCharacter *ch = NULL; separate_obj (obj); scraps = create_object (OIdxTable.GetObj (OBJ_VNUM_SCRAPS), 0); scraps->timer = number_range (5, 15); // don't make scraps of scraps of scraps of ... if (obj->pIndexData->vnum == OBJ_VNUM_SCRAPS) { scraps->SetShortDescr ("some debris"); scraps->SetDescription ("Bits of debris lie on the ground here."); } else { sprintf (buf, scraps->GetShortDescr (), obj->GetShortDescr ()); scraps->SetShortDescr (buf); sprintf (buf, scraps->GetDescription (), obj->GetShortDescr ()); scraps->SetDescription (buf); } if (obj->carried_by) { act (AT_OBJECT, "$p falls to the ground in scraps!", obj->carried_by, obj, NULL, TO_CHAR); if (obj == get_eq_char (obj->carried_by, WEAR_WIELD) && (tmpobj = get_eq_char (obj->carried_by, WEAR_DUAL_WIELD))) tmpobj->wear_loc = WEAR_WIELD; obj_to_room (scraps, obj->carried_by->GetInRoom ()); } else if (obj->in_room) { if (ch = obj->in_room->first_person) { act (AT_OBJECT, "$p is reduced to little more than scraps.", ch, obj, NULL, TO_ROOM); act (AT_OBJECT, "$p is reduced to little more than scraps.", ch, obj, NULL, TO_CHAR); } obj_to_room (scraps, obj->in_room); } if ((obj->item_type == ITEM_CONTAINER || obj->item_type == ITEM_CORPSE_PC) && ! obj->IsEmpty ()) { if (ch && ch->GetInRoom ()) { act (AT_OBJECT, "The contents of $p fall to the ground.", ch, obj, NULL, TO_ROOM); act (AT_OBJECT, "The contents of $p fall to the ground.", ch, obj, NULL, TO_CHAR); } if (obj->carried_by) empty_obj (obj, NULL, obj->carried_by->GetInRoom ()); else if (obj->in_room) empty_obj (obj, NULL, obj->in_room); else if (obj->in_obj) empty_obj (obj, obj->in_obj, NULL); } extract_obj (obj); } // Make a corpse out of a character. void make_corpse (CCharacter *ch, CCharacter *killer) { char buf [MAX_STRING_LENGTH]; CObjData *corpse; CObjData *obj; const char *name; if (ch->IsNpc ()) { name = ch->GetShortDescr (); corpse = create_object (OIdxTable.GetObj (OBJ_VNUM_CORPSE_NPC), 0); corpse->timer = 6; if (ch->GetGold () > 0) { if (ch->GetInRoom ()) ch->GetInRoom ()->GetArea ()->gold_looted += ch->GetGold (); obj_to_obj (create_money (ch->GetGold ()), corpse); ch->SetGold (0); } // Using corpse cost to cheat, since corpses not sellable corpse->cost = (- (int)ch->GetMobIndex ()->vnum); corpse->value [2] = corpse->timer; } else { name = ch->GetName (); corpse = create_object (OIdxTable.GetObj (OBJ_VNUM_CORPSE_PC), 0); corpse->timer = 40; corpse->value [2] = (int) (corpse->timer/8); if (ch->IsPkiller ()) corpse->SetClanCorpse (); // Pkill corpses get save timers, in ticks (approx 70 seconds) // This should be anough for the killer to type 'get all corpse'. if (! ch->IsNpc () && ! killer->IsNpc ()) corpse->value [3] = 1; else corpse->value [3] = 0; } // Added corpse name - make locate easier , other skills sprintf (buf, "corpse %s", name); corpse->SetName (buf); sprintf (buf, corpse->GetShortDescr (), name); corpse->SetShortDescr (buf); sprintf (buf, corpse->GetDescription (), name); corpse->SetDescription (buf); POSITION pos = ch->GetHeadCarryPos (); while (obj = ch->GetNextCarrying (pos)) { obj_from_char (obj); if (obj->IsInventory () || obj->IsDeathrot ()) extract_obj (obj); else obj_to_obj (obj, corpse); } obj_to_room (corpse, ch->GetInRoom ()); } void make_blood (CCharacter *ch) { CObjData *obj; obj = create_object (OIdxTable.GetObj (OBJ_VNUM_BLOOD), 0); obj->timer = number_range (2, 4); obj->value [1] = number_range (3, UMIN (5, ch->GetLevel ())); obj_to_room (obj, ch->GetInRoom ()); } void make_bloodstain (CCharacter *ch) { CObjData *obj; obj = create_object (OIdxTable.GetObj (OBJ_VNUM_BLOODSTAIN), 0); obj->timer = number_range (1, 2); obj_to_room (obj, ch->GetInRoom ()); } // make some coinage CObjData *create_money (int amount) { char buf [MAX_STRING_LENGTH]; CObjData *obj; if (amount <= 0) { bug ("Create_money: zero or negative money %d.", amount); amount = 1; } if (amount == 1) { obj = create_object (OIdxTable.GetObj (OBJ_VNUM_MONEY_ONE), 0); } else { obj = create_object (OIdxTable.GetObj (OBJ_VNUM_MONEY_SOME), 0); sprintf (buf, obj->GetShortDescr (), amount); obj->SetShortDescr (buf); obj->value [0] = amount; } return obj; }