GetItem() public method

public GetItem ( int plr, Item newItem, bool longText = false, bool noText = false ) : Item
plr int
newItem Item
longText bool
noText bool
return Item
コード例 #1
0
ファイル: Lang.cs プロジェクト: xiongyaya/Terraria
        public static string BartenderHelpText(NPC npc)
        {
            object substitutionObject = Lang.CreateDialogSubstitutionObject(npc);
            Player player             = Main.player[Main.myPlayer];

            if (player.bartenderQuestLog == 0)
            {
                ++player.bartenderQuestLog;
                Item newItem = new Item();
                newItem.SetDefaults(3817, false);
                newItem.stack    = 5;
                newItem.position = player.Center;
                Item obj = player.GetItem(player.whoAmI, newItem, true, false);
                if (obj.stack > 0)
                {
                    int number = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, obj.type, obj.stack, false, 0, true, false);
                    if (Main.netMode == 1)
                    {
                        NetMessage.SendData(21, -1, -1, (NetworkText)null, number, 1f, 0.0f, 0.0f, 0, 0, 0);
                    }
                }
                return(Language.GetTextValueWith("BartenderSpecialText.FirstHelp", substitutionObject));
            }
            LocalizedText[] all = Language.FindAll(Lang.CreateDialogFilter("BartenderHelpText.", substitutionObject));
            if (Main.BartenderHelpTextIndex >= all.Length)
            {
                Main.BartenderHelpTextIndex = 0;
            }
            return(all[Main.BartenderHelpTextIndex++].FormatWith(substitutionObject));
        }
コード例 #2
0
ファイル: Lang.cs プロジェクト: egshels/Sources
        public static string BartenderHelpText(NPC npc)
        {
            object obj    = CreateDialogSubstitutionObject(npc);
            Player player = Main.player[Main.myPlayer];

            if (player.bartenderQuestLog == 0)
            {
                player.bartenderQuestLog++;
                Item item = new Item();
                item.SetDefaults(3817);
                item.stack    = 5;
                item.position = player.Center;
                item          = player.GetItem(player.whoAmI, item, GetItemSettings.NPCEntityToPlayerInventorySettings);
                if (item.stack > 0)
                {
                    int number = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, item.type, item.stack, noBroadcast: false, 0, noGrabDelay: true);
                    if (Main.netMode == 1)
                    {
                        NetMessage.SendData(21, -1, -1, null, number, 1f);
                    }
                }
                return(Language.GetTextValueWith("BartenderSpecialText.FirstHelp", obj));
            }
            LocalizedText[] array = Language.FindAll(CreateDialogFilter("BartenderHelpText.", obj));
            if (Main.BartenderHelpTextIndex >= array.Length)
            {
                Main.BartenderHelpTextIndex = 0;
            }
            return(array[Main.BartenderHelpTextIndex++].FormatWith(obj));
        }