Esempio n. 1
0
 public void UpdateKillQuest(BaseNPC Sender)
 {
     if (Sender == Target.GetComponent <BaseNPC>())
     {
         CurrentAmount++;
     }
 }
Esempio n. 2
0
            void TryGetNewPet(BaseNPC npcPet)
            {
                var OwnedNpc = npcPet.GetComponent <NpcAI>();

                if (OwnedNpc != null && OwnedNpc.owner != this)
                {
                    owner.ChatMessage(NoOwn);
                    return;
                }

                if (NextTimeToControl >= Time.realtimeSinceStartup)
                {
                    owner.ChatMessage(ReloadMsg);
                    return;
                }

                if (UsePermission && !PluginInstance.HasPermission(owner, "can" + npcPet.mdlPrefab.Get().name.Replace("_skin", "")))
                {
                    owner.ChatMessage(NoPermPetMsg);
                    return;
                }

                NextTimeToControl = Time.realtimeSinceStartup + ReloadControl;

                npc       = npcPet.gameObject.AddComponent <NpcAI>();
                npc.owner = this;

                owner.ChatMessage(NewPetMsg);
            }
Esempio n. 3
0
 void UpdateAction()
 {
     if (npc != null && input.IsDown(SecondButton))
     {
         if (npc.action == Act.Follow)
         {
             owner.ChatMessage(UnFollowMsg);
             npc.action = Act.None;
         }
         else
         {
             owner.ChatMessage(FollowMsg);
             npc.Attack(owner.GetComponent <BaseCombatEntity>(), Act.Follow);
         }
     }
     else
     {
         RaycastHit hit;
         if (Physics.SphereCast(owner.eyes.position, 0.5f, Quaternion.Euler(input.current.aimAngles) * Vector3.forward, out hit) && hit.transform != transform)
         {
             if (npc == null)
             {
                 BaseNPC hited = hit.transform.GetComponent <BaseNPC>();
                 if (hited != null)
                 {
                     NpcAI OwnedNpc = hited.GetComponent <NpcAI>();
                     if (OwnedNpc != null && OwnedNpc.owner != this)
                     {
                         owner.ChatMessage(NoOwn);
                     }
                     else if (NextTimeToControl < Time.realtimeSinceStartup)
                     {
                         if (!UsePermission || PluginInstance.HasPermission(owner, "can" + hited.modelPrefab.Remove(0, 12).Replace("_skin", "")))
                         {
                             if (hit.distance < MaxControlDistance)
                             {
                                 NextTimeToControl = Time.realtimeSinceStartup + ReloadControl;
                                 owner.ChatMessage(NewPetMsg);
                                 npc       = hited.gameObject.AddComponent <NpcAI>();
                                 npc.owner = this;
                             }
                             else
                             {
                                 owner.ChatMessage(CloserMsg);
                             }
                         }
                         else
                         {
                             owner.ChatMessage(NoPermPetMsg);
                         }
                     }
                     else
                     {
                         owner.ChatMessage(ReloadMsg);
                     }
                 }
             }
             else
             {
                 BaseCombatEntity targetentity = hit.transform.GetComponent <BaseCombatEntity>();
                 if (targetentity == null)
                 {
                     npc.targetpoint = hit.point;
                     npc.action      = Act.Move;
                 }
                 else
                 {
                     if (targetentity == (BaseCombatEntity)npc.Base)
                     {
                         if (hit.distance <= LootDistance)
                         {
                             owner.inventory.loot.StartLootingEntity((BaseEntity)npc.Base, true);
                             owner.inventory.loot.AddContainer(npc.inventory);
                             owner.inventory.loot.SendImmediate();
                             owner.ClientRPC(owner.net.connection, owner, "RPC_OpenLootPanel", "smallwoodbox");
                         }
                     }
                     else if (targetentity is BaseCorpse)
                     {
                         owner.ChatMessage(EatMsg);
                         npc.Attack(targetentity, Act.Eat);
                     }
                     else
                     {
                         owner.ChatMessage(AttackMsg);
                         npc.Attack(targetentity);
                     }
                 }
             }
         }
     }
 }