コード例 #1
0
        private static void HandleOffhand(NWPlayer oPC, NWItem oMainHandPistol)
        {
            NWItem oOffHandPistol = CreateItemOnObject("offhandpistol", oPC);

            //if (NWNX.NWNXObject.CheckFit(oPC, (int)BaseItem.OffHandPistol) == 1)
            if (oOffHandPistol.Possessor == oPC)
            {
                //Console.WriteLine("It fits!");

                oOffHandPistol = CopyWeaponAppearance(oPC, oMainHandPistol, oOffHandPistol, false);
                oPC.AssignCommand(() =>
                {
                    ActionEquipItem(oOffHandPistol, InventorySlot.LeftHand);
                });
            }
            else
            {
                //Console.WriteLine("It doesn't fit :(");
                oPC.DelayAssignCommand(() =>
                {
                    ActionUnequipItem(oMainHandPistol);
                    DestroyObject(oOffHandPistol);
                }, 0.5f);
            }
        }
コード例 #2
0
        public bool IsPVPAttackAllowed(NWPlayer attacker, NWPlayer target)
        {
            // Check for sanctuary if this attack is PC versus PC
            if (target.IsPlayer && attacker.IsPlayer)
            {
                // Either the attacker or target has sanctuary - prevent combat from happening
                if (PlayerHasPVPSanctuary(attacker))
                {
                    attacker.FloatingText(_color.Red("You are under the effects of PVP sanctuary and cannot engage in PVP. To disable this feature permanently refer to the 'Disable PVP Sanctuary' option in your rest menu."));
                    attacker.DelayAssignCommand(() => attacker.ClearAllActions(), 0.0f);

                    return(false);
                }
                else if (PlayerHasPVPSanctuary(target))
                {
                    attacker.FloatingText(_color.Red("Your target is under the effects of PVP sanctuary and cannot engage in PVP combat."));
                    attacker.DelayAssignCommand(() => attacker.ClearAllActions(), 0.0f);
                    return(false);
                }
            }

            return(true);
        }
コード例 #3
0
        private static void OnModuleChat()
        {
            NWPlayer sender     = GetPCChatSpeaker();
            var      talkvolume = GetPCChatVolume();

            /*
             * ChatChannelType channel = (ChatChannelType)NWNXChat.GetChannel();
             *
             * if (!IsInCall(sender)) return;
             * if (channel != ChatChannelType.PlayerTalk) return;
             * if (channel != ChatChannelType.PlayerWhisper) return;
             * if (channel != ChatChannelType.PlayerParty) return;
             */

            if (talkvolume == TalkVolume.Shout)
            {
                return;
            }
            if (talkvolume == TalkVolume.Tell)
            {
                return;
            }
            if (talkvolume == TalkVolume.SilentShout)
            {
                return;
            }
            if (talkvolume == TalkVolume.SilentTalk)
            {
                return;
            }

            NWPlayer receiver = GetHoloGram(sender);

            string text = _.GetPCChatMessage().Trim();

            if (text.StartsWith("/"))
            {
                return;
            }

            var animation = Animation.LoopingTalkNormal;

            if (text.Contains("!"))
            {
                animation = Animation.LoopingTalkForceful;
            }
            if (text.Contains("?"))
            {
                animation = Animation.LoopingTalkPleading;
            }

            SetCommandable(true, receiver);
            receiver.ClearAllActions();

            receiver.AssignCommand(() =>
            {
                ActionPlayAnimation(animation);
            });

            receiver.DelayAssignCommand(() =>
            {
                ActionSpeakString(text, talkvolume);
            }, 0.3f);
        }