/// <summary> /// Give an item to someone. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Give(CharData ch, string[] str) { if( ch == null ) return; CharData victim; string arg1 = String.Empty; string arg2 = String.Empty; if (String.IsNullOrEmpty(arg1) || String.IsNullOrEmpty(arg2)) { ch.SendText("Give what to whom?\r\n"); return; } if (MUDString.IsNumber(arg1)) { /* 'give NNNN coins victim' */ string buf; string arg3 = String.Empty; int amount; Int32.TryParse(arg1, out amount); if (amount <= 0) { ch.SendText("Sorry, you can't do that.\r\n"); return; } if (String.IsNullOrEmpty(arg3)) { ch.SendText("Give what to whom?\r\n"); return; } victim = ch.GetCharRoom(arg3); if (victim == null) { ch.SendText("They aren't here.\r\n"); return; } if (!MUDString.IsPrefixOf(arg2, "copper")) { if (ch.GetCopper() < amount) { ch.SendText("You haven't got that many &+ycopper&n coins.\r\n"); return; } ch.SpendCopper(amount); SocketConnection.Act("You give $N&n some &+ycopper&n.", ch, null, victim, SocketConnection.MessageTarget.character); buf = String.Format("$n&n gives you {0} &+ycopper&n.", amount); SocketConnection.Act(buf, ch, null, victim, SocketConnection.MessageTarget.victim); SocketConnection.Act("$n&n gives $N&n some &+ycopper&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim); // prog_bribe_trigger( victim, ch, amount ); if (!ch.CheckQuest(victim, null, amount)) { victim.ReceiveCopper(amount); } // Prevent money duping CharData.SavePlayer(ch); CharData.SavePlayer(victim); return; } if (!MUDString.IsPrefixOf(arg2, "silver")) { if (ch.GetSilver() < amount) { ch.SendText("You haven't got that many silver coins.\r\n"); return; } ch.SpendSilver(amount); SocketConnection.Act("You give $N&n some silver.", ch, null, victim, SocketConnection.MessageTarget.character); buf = String.Format("$n&n gives you {0} silver.", amount); SocketConnection.Act(buf, ch, null, victim, SocketConnection.MessageTarget.victim); SocketConnection.Act("$n&n gives $N&n some silver.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim); // prog_bribe_trigger( victim, ch, amount * 10); if (!ch.CheckQuest(victim, null, (amount * 10))) victim.ReceiveSilver(amount); // Prevent money duping CharData.SavePlayer(ch); CharData.SavePlayer(victim); return; } if (!MUDString.IsPrefixOf(arg2, "gold")) { if (ch.GetGold() < amount) { ch.SendText("You haven't got that many &+Ygold&n coins.\r\n"); return; } ch.SpendGold(amount); SocketConnection.Act("You give $N&n some &+Ygold&n.", ch, null, victim, SocketConnection.MessageTarget.character); buf = String.Format("$n&n gives you {0} &+Ygold&n.", amount); SocketConnection.Act(buf, ch, null, victim, SocketConnection.MessageTarget.victim); SocketConnection.Act("$n&n gives $N&n some &+Ygold&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim); // prog_bribe_trigger( victim, ch, amount *100); if (!ch.CheckQuest(victim, null, (amount * 100))) { victim.ReceiveGold(amount); } // Prevent money duping CharData.SavePlayer(ch); CharData.SavePlayer(victim); return; } if (!MUDString.IsPrefixOf(arg2, "platinum")) { if (ch.GetPlatinum() < amount) { ch.SendText("You haven't got that many &+Wplatinum&n coins.\r\n"); return; } ch.SpendPlatinum(amount); SocketConnection.Act("You give $N&n some &+Wplatinum&n.", ch, null, victim, SocketConnection.MessageTarget.character); buf = String.Format("$n&n gives you {0} &+Wplatinum&n.", amount); SocketConnection.Act(buf, ch, null, victim, SocketConnection.MessageTarget.victim); SocketConnection.Act("$n&n gives $N&n some &+Wplatinum&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim); // prog_bribe_trigger( victim, ch, amount* 1000 ); if (!ch.CheckQuest(victim, null, (amount * 1000))) { victim.ReceivePlatinum(amount); } // Prevent money duping CharData.SavePlayer(ch); CharData.SavePlayer(victim); return; } ch.SendText("You don't have any of _that_ type of coin yet.\r\n"); return; } Object obj = ch.GetObjCarrying(arg1); if (!obj) { ch.SendText("You do not have that item.\r\n"); return; } if (obj.WearLocation != ObjTemplate.WearLocation.none) { ch.SendText("You must remove it first.\r\n"); return; } victim = ch.GetCharRoom(arg2); if (victim == null) { ch.SendText("They aren't here.\r\n"); return; } if (!ch.CanDropObject(obj)) { ch.SendText("You couldn't possibly part with it.\r\n"); return; } /* * How silly of shopkeepers to refuse blessed items... previously vampires would * refuse blessed items... now all undead types refuse blessed items. */ if (obj.HasFlag(ObjTemplate.ITEM_BLESS) && victim.IsUndead()) { SocketConnection.Act("$N&n refuses to touch the blessed $p&n.", ch, obj, victim, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n tries to give $N&n a $p&n but $E refuses.", ch, obj, victim, SocketConnection.MessageTarget.room); SocketConnection.Act("You refuse to accept the blessed $p&n from $n&n.", ch, obj, victim, SocketConnection.MessageTarget.victim); return; } if (victim.CarryNumber + 1 > Limits.MAX_CARRY) { SocketConnection.Act("$N&n has $S hands full.", ch, null, victim, SocketConnection.MessageTarget.character); return; } if (victim.CarryWeight + obj.GetWeight() > victim.MaxCarryWeight()) { SocketConnection.Act("$N&n cannot carry that much weight.", ch, null, victim, SocketConnection.MessageTarget.character); return; } if (!CharData.CanSeeObj(victim, obj)) { SocketConnection.Act("$N&n can't see it.", ch, null, victim, SocketConnection.MessageTarget.character); return; } obj.RemoveFromChar(); obj.ObjToChar(victim); // Prevent item duplication. CharData.SavePlayer(ch); CharData.SavePlayer(victim); SocketConnection.Act("You give $p&n to $N&n.", ch, obj, victim, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n gives you $p&n.", ch, obj, victim, SocketConnection.MessageTarget.victim); SocketConnection.Act("$n&n gives $p&n to $N&n.", ch, obj, victim, SocketConnection.MessageTarget.everyone_but_victim); // prog_give_trigger( victim, ch, obj ); if (Database.IsArtifact(obj.ObjIndexData.IndexNumber)) { string buf = String.Format("{0} has given artifact {1} to {2}", ch.Name, obj.ObjIndexData.IndexNumber, victim.Name); Log.Trace(buf); } if (!victim.IsNPC()) { return; } // Destroy the item so they can't kill the mob for the item. if (ch.CheckQuest(victim, obj, 0)) { obj.RemoveFromWorld(); } return; }
/// <summary> /// Drop an item. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Drop(CharData ch, string[] str) { if( ch == null ) return; Object cash; if (ch.IsAffected( Affect.AFFECT_HOLD) || ch.IsAffected( Affect.AFFECT_MINOR_PARA)) { ch.SendText("You muscles won't respond!\r\n"); return; } if (str.Length == 0) { ch.SendText("Drop what?\r\n"); return; } if (MUDString.IsNumber(str[0])) { /* 'drop NNNN coins' */ int amount; Int32.TryParse(str[0], out amount); if (amount <= 0) { ch.SendText("Sorry, you can't do that.\r\n"); return; } if (str.Length < 2) { ch.SendText("That's fine, but *what* do you want to drop?\r\n"); return; } if ("copper".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (ch.GetCopper() < amount) { ch.SendText("You haven't got that many &n&+ycopper&n coins.\r\n"); return; } ch.SpendCopper(amount); cash = Object.CreateMoney(amount, 0, 0, 0); cash.AddToRoom(ch.InRoom); cash.FlyLevel = ch.FlightLevel; } else if ("silver".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (ch.GetSilver() < amount) { ch.SendText("You haven't got that many &n&+wsilver&n coins.\r\n"); return; } ch.SpendSilver(amount); (Object.CreateMoney(0, amount, 0, 0)).AddToRoom(ch.InRoom); } else if ("gold".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (ch.GetGold() < amount) { ch.SendText("You haven't got that many &+Ygold&n coins.\r\n"); return; } ch.SpendGold(amount); (Object.CreateMoney(0, 0, amount, 0)).AddToRoom(ch.InRoom); } else if ("platinum".StartsWith(str[1], StringComparison.CurrentCultureIgnoreCase)) { if (ch.GetPlatinum() < amount) { ch.SendText("You haven't got that many &+Wplatinum&n coins.\r\n"); return; } ch.SpendPlatinum(amount); (Object.CreateMoney(0, 0, 0, amount)).AddToRoom(ch.InRoom); } else { ch.SendText("They haven't minted that type of &+Lcoin&n yet.\r\n"); return; } /* Disabled merging of coin types. This should eventually be re-enabled for ( obj = ch.in_room.contents; obj; obj = obj_next ) { obj_next = obj.next_content; switch ( obj.pIndexData.vnum ) { case StaticObjects.OBJECT_NUMBER_MONEY_ONE: amount += 1; obj.ExtractFromWorld();; break; case StaticObjects.OBJECT_NUMBER_MONEY_SOME: amount += obj.value[0]; obj.ExtractFromWorld();; break; } } */ ch.SendText("Done.\r\n"); SocketConnection.Act("$n&n drops some &n&+wcoins&n.", ch, null, null, SocketConnection.MessageTarget.room); return; } if (str[0] != "all" && MUDString.IsPrefixOf("all.", str[0])) { /* 'drop iobj' */ Object iobj = ch.GetObjCarrying(str[0]); if (!iobj) { ch.SendText("You do not have that item.\r\n"); return; } if (!ch.CanDropObject(iobj)) { ch.SendText("You can't release your grip on it.\r\n"); return; } iobj.RemoveFromChar(); iobj.AddToRoom(ch.InRoom); // Prevent item duping - Xangis CharData.SavePlayer(ch); iobj.FlyLevel = ch.FlightLevel; SocketConnection.Act("You drop $p&n.", ch, iobj, null, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n discards $p&n.", ch, iobj, null, SocketConnection.MessageTarget.room); if (iobj.HasFlag(ObjTemplate.ITEM_TRANSIENT)) { SocketConnection.Act("$p&n crumbles to dust.", ch, iobj, null, SocketConnection.MessageTarget.all); iobj.RemoveFromWorld(); } else if (ch.InRoom.TerrainType == TerrainType.lava && !iobj.HasFlag(ObjTemplate.ITEM_NOBURN)) { SocketConnection.Act("$p&n melts as it sinks into the &+RLava&n.", ch, iobj, null, SocketConnection.MessageTarget.all); if (!ch.IsNPC()) { ((PC)ch).Destroyed.AddItem(iobj); } iobj.RemoveFromWorld(); } } else { /* 'drop all' or 'drop all.obj' */ bool found = false; for (int i = ch.Carrying.Count - 1; i >= 0 ; i--) { Object obj = ch.Carrying[i]; if ( (str.Length < 2 || MUDString.NameContainedIn(str[0].Substring(4), obj.Name)) && CharData.CanSeeObj(ch, obj) && obj.WearLocation == ObjTemplate.WearLocation.none && ch.CanDropObject(obj)) { found = true; obj.RemoveFromChar(); obj.AddToRoom(ch.InRoom); SocketConnection.Act("You drop $p&n.", ch, obj, null, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n drops $p&n.", ch, obj, null, SocketConnection.MessageTarget.room); if (obj.HasFlag(ObjTemplate.ITEM_TRANSIENT)) { SocketConnection.Act("$p&n crumbles to dust.", ch, obj, null, SocketConnection.MessageTarget.all); if (!ch.IsNPC()) { ((PC)ch).Destroyed.AddItem(obj); } obj.RemoveFromWorld(); } else if (ch.InRoom.TerrainType == TerrainType.lava && !obj.HasFlag(ObjTemplate.ITEM_NOBURN)) { SocketConnection.Act("$p&n melts as it sinks into the &+RLava&n.", ch, obj, null, SocketConnection.MessageTarget.all); if (!ch.IsNPC()) { ((PC)ch).Destroyed.AddItem(obj); } obj.RemoveFromWorld(); } } } if (!found) { if (str.Length > 1) { ch.SendText("You are not carrying anything."); } else { SocketConnection.Act("You are not carrying any $T&n.", ch, null, str[0].Substring(4), SocketConnection.MessageTarget.character); } } } return; }
/// <summary> /// Value: Find out how much a shopkeeper will pay for an item. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Value(CharData ch, string[] str) { if( ch == null ) return; Object obj; CharData keeper; int cost; if (str.Length == 0) { ch.SendText("Value what?\r\n"); return; } if (!(keeper = ch.FindShopkeeper(""))) return; if (!(obj = ch.GetObjCarrying(str[0]))) { SocketConnection.Act("$n&n tells you 'You don't have that item'.", keeper, null, ch, SocketConnection.MessageTarget.victim); ch.ReplyTo = keeper; return; } if (!ch.CanDropObject(obj)) { ch.SendText("That's not something you can sell.\r\n"); return; } if (!CharData.CanSeeObj(keeper, obj)) { SocketConnection.Act("$n&+W tells you 'You are offering me an imaginary object!?!?'&n", keeper, null, ch, SocketConnection.MessageTarget.victim); ch.ReplyTo = keeper; return; } if ((cost = Object.GetCost(ch, keeper, obj, false)) <= 0) { SocketConnection.Act("$n&n looks uninterested in $p&n.", keeper, obj, ch, SocketConnection.MessageTarget.victim); return; } if (obj.HasFlag(ObjTemplate.ITEM_POISONED)) { SocketConnection.Act("$n&+W tells you 'I won't buy that! It's poisoned!'&n", keeper, null, ch, SocketConnection.MessageTarget.victim); ch.ReplyTo = keeper; return; } string buf = String.Format("$n&+W tells you 'I'll give you {0} &n&+ycopper&+W coins for $p&n.'", cost); SocketConnection.Act(buf, keeper, obj, ch, SocketConnection.MessageTarget.victim); ch.ReplyTo = keeper; return; }
/// <summary> /// Steal an object or some coins from a victim. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Steal(CharData ch, string[] str) { if( ch == null ) return; Object obj = null; CharData victim; bool sleeping = false; string arg1 = String.Empty; string arg2 = String.Empty; string arg = String.Empty; int percent; if (!ch.HasSkill("steal") && !ch.IsAffected(Affect.AFFECT_CHARM)) { ch.SendText("Who are you trying to kid? You couldn't steal shoes from a &n&+mbl&+Mo&n&+ma&+Mte&n&+md&n corpse.\r\n"); return; } if (ch.Riding != null) { ch.SendText("You can't do that while mounted.\r\n"); return; } if (String.IsNullOrEmpty(arg1) || String.IsNullOrEmpty(arg2)) { ch.SendText("Steal what from whom?\r\n"); return; } if ((victim = ch.GetCharRoom(arg2)) == null) { ch.SendText("They aren't here.\r\n"); return; } if (victim == ch) { ch.SendText("That's pointless.\r\n"); return; } if (Combat.IsSafe(ch, victim)) return; if (!ch.IsImmortal()) { ch.WaitState(Skill.SkillList["steal"].Delay); } // Justice stuff Crime.CheckThief(ch, victim); if (ch.IsNPC()) { percent = ch.Level * 2; } else { percent = ((PC)ch).SkillAptitude["steal"]; } percent += ch.GetCurrLuck() / 20; /* Luck */ percent -= victim.Level; /* Character level vs victim's */ if (ch.GetRace() == Race.RACE_HALFLING) { // Halflings get a racial bonus percent += 10; } if (victim.IsAffected(Affect.AFFECT_CURSE)) percent += 15; if (ch.IsAffected(Affect.AFFECT_CURSE)) percent -= 15; if (!victim.IsAwake()) percent += 25; /* Sleeping characters are easier */ if (ch.CheckSneak()) percent += 10; /* Quiet characters steal better */ if (!CharData.CanSee(ch, victim)) percent += 10; /* Unseen characters steal better */ if (!MUDString.IsPrefixOf(arg1, "coins")) { percent = (int)(percent * 1.2); /* Cash is fairly easy to steal */ } else { int number = MUDString.NumberArgument(arg1, ref arg); int count = 0; foreach (Object iobj in victim.Carrying) { if (CharData.CanSeeObj(ch, iobj) && MUDString.NameContainedIn(arg, iobj.Name)) { if (++count == number) { obj = iobj; break; } } } if (!obj) { ch.SendText("You can't find it.\r\n"); return; } if (ch.Level < victim.Level) { // stealing from higher level is possible, but harder percent -= 5 * (victim.Level - ch.Level); } else { // slight bonus for mobs lower level percent += (ch.Level - victim.Level); } if (obj.WearLocation == ObjTemplate.WearLocation.none) /* Items worn are harder */ percent = (int)(percent * .8); else percent = (int)(percent * .4); } ch.PracticeSkill("steal"); if (percent > 85) percent = 85; if (percent < 2) percent = 2; if (percent < MUDMath.NumberPercent()) { /* * Failure. */ //strip sneak ch.RemoveAffect(Affect.AFFECT_SNEAK); // chance of removing invis if (ch.IsAffected(Affect.AFFECT_INVISIBLE) && MUDMath.NumberPercent() > percent) { ch.SendText("You really bungled that attempt.\r\n"); ch.RemoveAffect(Affect.AFFECT_INVISIBLE); } else { ch.SendText("Oops.\r\n"); } SocketConnection.Act("$n&n tried to steal from $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim); if (victim.IsAwake()) { SocketConnection.Act("$n&n tried to steal from you!", ch, null, victim, SocketConnection.MessageTarget.victim); } else { sleeping = true; } // Thief flag for justice. // Added so blind mobs dont hit who ever failed steal from em. if (victim.IsNPC()) { if (!sleeping && !victim.IsBlind()) { CommandType.Interpret(victim, "kill " + ch.Name); } } else { if (!victim.IsBlind() && !sleeping && victim.IsAffected(Affect.AFFECT_BERZERK)) { victim.SendText("In your &+Rblood rage&n, you lash out in anger!\r\n"); CommandType.Interpret(victim, "kill " + ch.Name); } } /* if ( !Macros.IS_SET( ch.actflags, PC.PLAYER_THIEF ) ) { Macros.SET_BIT( ref ch.actflags, PC.PLAYER_THIEF ); buf = String.Format( "{0} became a THIEF by stealing from {1}", ch._name, victim._name ); Immtalk.Immtalk( ch, Immtalk.IMMTALK_CRIME, ch.GetTrust(), buf ); CharData.SavePlayer( ch ); } */ // } if (sleeping) { if (MUDMath.NumberPercent() < victim.GetCurrLuck()) { CommandType.Interpret(victim, "wake"); } } return; } //end failure if (!MUDString.IsPrefixOf(arg1, "coins")) { int amount = victim.GetGold() * MUDMath.NumberRange(1, 20) / 100; int amount2 = victim.GetSilver() * MUDMath.NumberRange(1, 20) / 100; int amount3 = victim.GetCopper() * MUDMath.NumberRange(1, 20) / 100; int amount4 = victim.GetPlatinum() * MUDMath.NumberRange(1, 20) / 100; if ((amount + amount2 + amount3 + amount4) <= 0) { ch.SendText("You couldn't get any &n&+wcoins&n.\r\n"); return; } ch.ReceiveGold(amount); ch.ReceiveSilver(amount2); ch.ReceiveCopper(amount3); ch.ReceivePlatinum(amount4); victim.SpendGold(amount); victim.SpendSilver(amount2); victim.SpendCopper(amount3); victim.SpendPlatinum(amount4); string text = String.Format("Success! You got {0} &+Wplatinum&n, {1} &+Ygold&n, {2} silver, and {3} &+ycopper&n.\r\n", amount2, amount3, amount, amount4); ch.SendText(text); return; } if (!ch.CanDropObject(obj) || obj.HasFlag(ObjTemplate.ITEM_INVENTORY)) { ch.SendText("You can't pry it away.\r\n"); return; } if (ch.CarryNumber + 1 > Limits.MAX_CARRY) { ch.SendText("You have your hands full.\r\n"); return; } if (ch.CarryWeight + obj.GetWeight() > ch.MaxCarryWeight()) { ch.SendText("You cannot carry that much weight.\r\n"); return; } if (obj.WearLocation != ObjTemplate.WearLocation.none) { ch.SendText("Very daring, and you got it!\r\n"); victim.UnequipObject(obj); } obj.RemoveFromChar(); obj.ObjToChar(ch); ch.SendText("Nice work.\r\n"); if (obj.Trap != null && obj.Trap.CheckTrigger( Trap.TriggerType.steal)) { ch.SetOffTrap(obj); if (ch.CurrentPosition == Position.dead) { return; } } return; }
/// <summary> /// Sell an item. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Sell(CharData ch, string[] str) { if( ch == null ) return; Object obj; CharData keeper; string arg2 = String.Empty; int cost; if (str.Length == 0) { ch.SendText("Sell what?\r\n"); return; } if (!(keeper = ch.FindShopkeeper(arg2))) { return; } if (!ch.IsNPC()) { // Won't buy from bottom 25% of faction range. if (((PC)ch).GetFaction(keeper) < (Limits.MIN_FACTION / 2)) { SocketConnection.Act("$n&+W tells you 'I won't do business with scum like you.'&n", keeper, null, ch, SocketConnection.MessageTarget.victim); ch.ReplyTo = keeper; return; } } if (!(obj = ch.GetObjCarrying(str[0]))) { SocketConnection.Act("$n&+W tells you 'You don't have that item.'&n", keeper, null, ch, SocketConnection.MessageTarget.victim); ch.ReplyTo = keeper; return; } if (!ch.CanDropObject(obj)) { ch.SendText("You couldn't possibly part with that.\r\n"); return; } if (!CharData.CanSeeObj(keeper, obj)) { SocketConnection.Act("$n&+W tells you 'I can't see that item.'&n", keeper, null, ch, SocketConnection.MessageTarget.victim); ch.ReplyTo = keeper; return; } if ((cost = Object.GetCost(ch, keeper, obj, false)) <= 0 || obj.HasFlag(ObjTemplate.ITEM_NOSELL)) { SocketConnection.Act("$n&n looks uninterested in $p&n.", keeper, obj, ch, SocketConnection.MessageTarget.victim); return; } if (cost > obj.Cost) { Log.Error("Shopkeeper with index number {0} buys for more than 100 percent of value.\r\n", keeper.MobileTemplate.IndexNumber); cost = obj.Cost; } if (cost < 1) cost = 1; if (obj.HasFlag(ObjTemplate.ITEM_POISONED)) { SocketConnection.Act("$n&+W tells you 'I won't buy that! It's poisoned!'&n", keeper, null, ch, SocketConnection.MessageTarget.victim); ch.ReplyTo = keeper; return; } string buf = String.Format("You sell $p&n for {0}.", StringConversion.CoinString(cost)); SocketConnection.Act(buf, ch, obj, null, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n sells $p&n.", ch, obj, null, SocketConnection.MessageTarget.room); ch.ReceiveCash(cost); if (obj.ItemType == ObjTemplate.ObjectType.trash) { obj.RemoveFromWorld(); } else { obj.RemoveFromChar(); obj.ObjToChar(keeper); // Selling an object decreases its scarcity. --obj.ObjIndexData.Scarcity; } return; }
/// <summary> /// Put an object into another object. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Put(CharData ch, string[] str) { if( ch == null ) return; Object obj; if (str.Length < 2) { ch.SendText("Put what into what?\r\n"); return; } if (!MUDString.StringsNotEqual(str[1], "all") || !MUDString.IsPrefixOf("all.", str[1])) { ch.SendText("You can't do that.\r\n"); return; } Object container = ch.GetObjHere(str[1]); if (!container) { SocketConnection.Act("You see no $T&n here.", ch, null, str[1], SocketConnection.MessageTarget.character); return; } /* Added put <missileweap> <quiver> */ if (container.ItemType != ObjTemplate.ObjectType.container && container.ItemType != ObjTemplate.ObjectType.quiver) { ch.SendText("That's not a container.\r\n"); return; } if (Macros.IsSet(container.Values[1], ObjTemplate.CONTAINER_CLOSED.Vector)) { SocketConnection.Act("The $d&n is &n&+ystrapped&n shut.", ch, null, container.Name, SocketConnection.MessageTarget.character); return; } if (str[0] != "all" && MUDString.IsPrefixOf("all.", str[0])) { /* 'put obj container' */ obj = ch.GetObjCarrying(str[0]); if (!obj) { ch.SendText("You do not have that item.\r\n"); return; } if (obj == container) { ch.SendText("You can't fold it into itself.\r\n"); return; } if (!ch.CanDropObject(obj)) { ch.SendText("You can't seem to let go of it.\r\n"); return; } if (obj.GetWeight() + container.GetWeight() - container.Weight > container.Values[0]) { ch.SendText("It won't fit.\r\n"); return; } /* Added put <missileweap> <quiver> */ if (container.ItemType == ObjTemplate.ObjectType.quiver && obj.ItemType != ObjTemplate.ObjectType.missile_weapon) { SocketConnection.Act("$p&n doesn't belong in $P&n.", ch, obj, container, SocketConnection.MessageTarget.character); return; } obj.RemoveFromChar(); container.AddToObject(obj); SocketConnection.Act("You put $p&n in $P&n.", ch, obj, container, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n slips $p&n into $P&n.", ch, obj, container, SocketConnection.MessageTarget.room); if (obj.Trap != null && obj.Trap.CheckTrigger(Trap.TriggerType.get_put)) { ch.SetOffTrap(obj); } } else { /* 'put all container' or 'put all.obj container' */ bool stuff = false; foreach (Object iobj in ch.Carrying) { if (iobj.WearLocation != ObjTemplate.WearLocation.none) { continue; } if (container.ItemType == ObjTemplate.ObjectType.quiver && iobj.ItemType != ObjTemplate.ObjectType.missile_weapon) { continue; } if ((str[0][3] == '\0' || MUDString.NameContainedIn(str[0].Substring(4), iobj.Name)) && CharData.CanSeeObj(ch, iobj) && iobj.WearLocation == ObjTemplate.WearLocation.none && iobj != container && ch.CanDropObject(iobj) && iobj.GetWeight() + container.GetWeight() <= container.Values[0]) { iobj.RemoveFromChar(); container.AddToObject(iobj); stuff = true; SocketConnection.Act("You put $p&n in $P&n.", ch, iobj, container, SocketConnection.MessageTarget.character); // Descriptor._actFlags( "$n&n puts $p&n in $P&n.", ch, iobj, container, Descriptor.MessageTarget.room ); if (iobj.Trap != null && iobj.Trap.CheckTrigger( Trap.TriggerType.get_put)) { ch.SetOffTrap(iobj); if (ch.CurrentPosition == Position.dead) { return; } } } else if (iobj.GetWeight() + container.GetWeight() > container.Values[0] && iobj != container) { SocketConnection.Act("$p&n won't fit into $P&n.", ch, iobj, container, SocketConnection.MessageTarget.character); } } if (stuff) { SocketConnection.Act("$n&n puts some stuff in $P&n.", ch, null, container, SocketConnection.MessageTarget.room); } } return; }