Exemplo n.º 1
0
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            if (args.Length < 1)
            {
                caller.Reply(Usage);
            }
            else
            {
                Item item = Main.mouseItem;

                if (PetRenamer.IsPetItem(item))
                {
                    PRItem petItem = item.GetGlobalItem <PRItem>();

                    string previousName = petItem.petName;
                    string newName      = "";

                    for (int i = 0; i < args.Length; i++)
                    {
                        newName += args[i] + ((i != args.Length - 1) ? " " : "");
                    }

                    if (previousName != string.Empty && newName == RESET)
                    {
                        petItem.petName  = string.Empty;
                        petItem.petOwner = string.Empty;
                        caller.Reply("Nickname '" + previousName + "' reset", Color.OrangeRed);
                    }
                    else
                    {
                        petItem.petName  = newName;
                        petItem.petOwner = caller.Player.name;
                        if (previousName == string.Empty)
                        {
                            caller.Reply("Named the pet summoned by " + item.Name + " '" + petItem.petName + "'", Color.Orange);
                        }
                        else if (previousName == petItem.petName)
                        {
                            caller.Reply("Pet is already called '" + previousName + "'", Color.OrangeRed);
                        }
                        else
                        {
                            caller.Reply("Renamed the pet summoned by " + item.Name + " from '" + previousName + "' to '" + petItem.petName + "'", Color.Orange);
                        }
                    }
                }
                else
                {
                    if (item.type == ItemID.None)
                    {
                        caller.Reply("No item to rename! Hold a pet summon item in your cursor", Color.OrangeRed);
                    }
                    else
                    {
                        caller.Reply(item.Name + " is not a valid item!", Color.OrangeRed);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override GlobalItem Clone(Item item, Item itemClone)
        {
            PRItem myClone = (PRItem)base.Clone(item, itemClone);

            myClone.petName  = petName;
            myClone.petOwner = petOwner;
            return(myClone);
        }
Exemplo n.º 3
0
        private void SetTypeAndNameOfCurrentEquippedPetInSlot(int slot, ref int type, ref string name)
        {
            Item item = player.miscEquips[slot];

            if (!player.hideMisc[slot] && PetRenamer.IsPetItem(item))
            {
                PRItem petItem = item.GetGlobalItem <PRItem>();
                type = item.shoot;
                name = petItem.petName;
            }
        }