Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ UnlockOrExchangePet()

static void Terraria.NPC.UnlockOrExchangePet ( ref bool petBoughtFlag,
int npcType,
string textKeyForLicense,
int netMessageData )
inlinestatic

Definition at line 77747 of file NPC.cs.

77748 {
77749 Color color = new Color(50, 255, 130);
77750 if (Main.netMode == 1)
77751 {
77752 if (!petBoughtFlag || AnyNPCs(npcType))
77753 {
77754 NetMessage.SendData(61, -1, -1, null, Main.myPlayer, netMessageData);
77755 }
77756 }
77757 else if (!petBoughtFlag)
77758 {
77759 petBoughtFlag = true;
77761 NetMessage.TrySendData(7);
77762 }
77764 {
77765 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Misc.PetExchangeSuccess"), color);
77766 }
77767 else
77768 {
77769 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Misc.PetExchangeFail"), color);
77770 }
77771 }
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:46
static NetworkText FromKey(string key, params object[] substitutions)
static bool RerollVariationForNPCType(int npcType)
Definition NPC.cs:77773
static bool AnyNPCs(int Type)
Definition NPC.cs:86689
Color color
Definition NPC.cs:487

References Terraria.Chat.ChatHelper.BroadcastChatMessage(), Microsoft.Xna.Framework.Graphics.Color, Terraria.Localization.NetworkText.FromKey(), Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.NetMessage.SendData(), and Terraria.NetMessage.TrySendData().

Referenced by Terraria.MessageBuffer.GetData(), and Terraria.Player.LicenseOrExchangePet().