public void CopyVariables(NWObject oSource, NWObject oCopy)
        {
            int variableCount = _nwnxObject.GetLocalVariableCount(oSource);

            for (int variableIndex = 0; variableIndex < variableCount - 1; variableIndex++)
            {
                LocalVariable stCurVar = _nwnxObject.GetLocalVariable(oSource, variableIndex);

                switch (stCurVar.Type)
                {
                case LocalVariableType.Int:
                    oCopy.SetLocalInt(stCurVar.Key, oSource.GetLocalInt(stCurVar.Key));
                    break;

                case LocalVariableType.Float:
                    oCopy.SetLocalFloat(stCurVar.Key, oSource.GetLocalFloat(stCurVar.Key));
                    break;

                case LocalVariableType.String:
                    oCopy.SetLocalString(stCurVar.Key, oSource.GetLocalString(stCurVar.Key));
                    break;

                case LocalVariableType.Object:
                    oCopy.SetLocalObject(stCurVar.Key, oSource.GetLocalObject(stCurVar.Key));
                    break;

                case LocalVariableType.Location:
                    oCopy.SetLocalLocation(stCurVar.Key, oSource.GetLocalLocation(stCurVar.Key));
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void JumpPCToBuildingInterior(NWPlayer player, NWArea area)
        {
            NWObject exit = null;

            NWObject @object = (_.GetFirstObjectInArea(area.Object));

            while (@object.IsValid)
            {
                if (@object.Tag == "building_exit")
                {
                    exit = @object;
                }

                @object = (_.GetNextObjectInArea(area.Object));
            }

            if (exit == null)
            {
                player.FloatingText("ERROR: Couldn't find the building interior's exit. Inform an admin of this issue.");
                return;
            }

            _player.SaveLocation(player);

            exit.SetLocalLocation("PLAYER_HOME_EXIT_LOCATION", player.Location);
            exit.SetLocalInt("IS_BUILDING_DOOR", 1);

            Location location = area.GetLocalLocation("INSTANCE_ENTRANCE");

            player.AssignCommand(() =>
            {
                _.ActionJumpToLocation(location);
            });
        }